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

  • SEARCH
  • Home
  • 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 9159889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:36:12+00:00 2026-06-17T13:36:12+00:00

I have four tables in my data model viz., Student, Elective, Elective Value, and

  • 0

I have four tables in my data model viz.,

  • Student,
  • Elective,
  • Elective Value, and
  • Student Elective.

The Student table contains the list of students with the student id as primary key.

The Elective table contains the list of elective the college offers with elective id as primary key.

The Elective Value table contains the list of the possible values for each elective. The primary key for this table is combination of the elective id and value id(Composite primary key), so for next elective the value starts from 1.

The student elective table contains the student id, elective id and value id as primary key. But I have been asked to do the following changes,

Have a id for the elective value table instead of composite primary key and use the primary key(id) in the student elective table. So the link between the elective table and the student elective breaks. May I know what is the best approach the former or the latter?

  • 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-06-17T13:36:13+00:00Added an answer on June 17, 2026 at 1:36 pm

    The second way is generally considered the ‘better’ way since it is normalized and allows the elective value to change in the future with far less disruption and allows the db engine to optimize queries on the fly. And if the value is a string you may actually save some space in the db. Here’s the model as I think you described it:

    Student
        StudentID
    
    Elective
        ElectiveID
    
    ElectiveValue
        ElectiveValueID
        FK_ElectiveID
        Value
    
    StudentElective
        StudentElectiveValueID
        FK_StudentID
        FK_ElectiveValueID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have four tables: days CREATE TABLE days ( day text priamry key );
I have four HTML tables and have to compare data from one table with
i have four tables user-question contains two columns: questionID, userID, the questions that the
I have four tables. Three of them are tables with one key and they
i have four tables like below in sql server 2008 : TABLE 1 ->
I used JPA and mysql. Each table have entity class.I have four tables. Table1
I have three tables, table one (tableA) containing users data like name and email,
I have created the SQL script below that creates four tables and inserts data
How can I fetch data from four tables? I have four tables: Article_Table (
I have four tables ie. custAddress custCompany custContact and custInfo All of the table

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.