Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3753662
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:25:34+00:00 2026-05-19T09:25:34+00:00

I need help in building simple database structure. Kind of stuck. Here’s what I’m

  • 0

I need help in building simple database structure. Kind of stuck.

Here’s what I’m trying.

Class means Department+Semester. Eg, Electronics Engineering SemI, Electrical Engg Sem II.. etc..

Student is in class;
Class has a defined group of subjects;
Group consists of multiple subjects.

Class and Subjects, 2 entities depend on same SubjectGroup entity. So isn’t this a ternary relationship ?

I’ve made this image to make picture clear.
[ P = Primary key; F = Foreign Key; Arrows do not mean anything of One-to-many/many to many etc.. they are just showing what referenced where]

alt text

I am stuck because I can not refer to GroupId two times.

How should I modify this structure ?

–
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T09:25:35+00:00Added an answer on May 19, 2026 at 9:25 am

    Entities

    • Student.
    • Class.
    • Subject.

    Relationships

    • Student to Class. One to Many. One class relates to many students.
    • Subject to Class. One to Many. One class relates to many subjects.

    Tables

    Student

    Columns:

    • studentId – primary key of the student table.
    • stuff about sutdent (some number of columns).
    • classId – foreign key into the class table.

    Subject

    Columns:

    • subjectId – primary key of the subject table.
    • stuff about subject (some number of columns).
    • classId – foreign key into the class table.

    Class

    • classId – primary key of the class table.
    • stuff about a class. nothing about student. nothing about subject. no foreign key to student. no foreign key to subject.

    Queries

    Students in a class

    select
        s.studentName
    from
        class c
        inner join student s on s.classId = c.classId
    where
        c.classId = 'desired class id'

    Subjects Student is Studying

    select
        sub.subjectName
    from
        student stu
        inner join subject sub on sub.classId = stu.classId
    where
        stu.studentId = 'desired student id'
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a simple PHP file manager, and I need help getting files to
My apologies for asking such a novice question but, I need help building a
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card
need help in error in database pivot. i have table tamed table_score like below:
I'm a non-developer building a simple Access 2003 database for an NGO that works
I'm building a simple framework and hoping it will help me better understand OOP.
I am new to WPF and need some help and guidance. I am building
I need help building a loop in my stored procedure, basically i want it
Need help writing a script downloads data from google insight using c# this is
need help/guide for sql select query, I have 2 table stock and stock_history, in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.