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 918403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:22:10+00:00 2026-05-15T18:22:10+00:00

I have three tables STUDENT, DEPARTMENT and COURSE in a University database… STUDENT has

  • 0

I have three tables STUDENT, DEPARTMENT and COURSE in a University database…
STUDENT has a UID as a Primary key -> which is the UNIQUE ID of the student
DEPARTMENT has Dept_id as a Primary Key -> which is the Dept. number
COURSE has C_id as Primary Key -> which is the Course/subject Id

I need to store marks in a table by relating the primary key of STUDENT, DEPARTMENT and COURSE for each student in each course.

UID Dept_id C_id marks
1    CS     CS01  98
1    CS     CS02  96
1    ME     ME01  88
1    ME     ME02  90

The problem is if i create a table like this for marks then i feel the data operator might insert wrong combination of primary key of a student for example

UID Dept_id C_id marks
1    CS     CS01  98
1    CS     CS02  96
1    ME     CS01  88 //wrong C_id (course id) inputted by the DBA
1    ME     ME02  90

In which case how can i prevent him doing this?
Also is there any other way to store marks for each student ? I mean like :

UID Dept_id CS01 CS02
1    CS      98   96
3    CS      95   92
  • 1 1 Answer
  • 4 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-15T18:22:11+00:00Added an answer on May 15, 2026 at 6:22 pm

    You should avoid duplicating data in your database if possible:

    UID Dept_id C_id marks
    1    CS     CS01  98
         ^^     ^^
    

    You could:

    • Change the course ID to a two column key (department, course number), eg (‘CS’, ’01’).

    or:

    • Keep the course name as it is, but put the department ID field in the course table and omit it from your marks table. If you need to calculate the total marks for a specific department you can still do this easily by adding a JOIN to your query.

    Your last suggestion seems to be a bad idea. You would need a column in your table for every course and most values would be NULL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables as below: Student: oneID (primary key), col1, col2, col3, subId,
Hey I have 3 tables called STUDENT, COURSE and ENROLLMENT. STUDENT has a PK
I have the following tables: Student Data Student ID (primary key) Prior Education Student
I have three tables. The designs were like student table create table student (studID
I have a database table named 'student' in which there is one column named
I have three tables in a Mysql database - countries, cities and hotels. Their
I have a student and faculty table. The primary key for student is studendID
I have to copy data for one student (clone student) that encompass three tables:
Say we have three entities in our environment, Teacher , Student and Course .
I'm working on university project and it has many domains like Course,department,Faculty etc.I want

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.