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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:50:14+00:00 2026-06-12T20:50:14+00:00

I have a mini enrollment system. there are tables for professors, subjects, students, grades,

  • 0

I have a mini enrollment system.

there are tables for professors, subjects, students, grades, and subjects that has students.

now, when you add a professor, you input it’s professor ID. but there is aslo a profNO. and the profNo is the primary key. since you can add more subjects to that professor, the profNo will increment but the ID stays the same.

PROBLEM: now, I want to set a restriction that when one wants to add a professor, if he inputs a professor ID that already exists, an error would appear which says “professor ID already exists” but the professor ID is not unique.

now, take a look at the photo. there are same professor IDs with different profNo. and that is because of the subjects they have. professor IDs were duplicated when you add subject to a professor. but when you add a professor, could it be possible that when one inputs an existing ID, an error would appear?
sample http://sphotos-e.ak.fbcdn.net/hphotos-ak-ash3/578472_162759700529875_718824031_n.jpg

  • 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-12T20:50:15+00:00Added an answer on June 12, 2026 at 8:50 pm

    Yes you can do what you’re asking. Just add a simple check before you insert new professors.

    Pseudocode for when a new professor is submitted:

    if profID already exists (using a simple SQL query to check)
        allow the insert and continue
    else
        don't insert, show a message to the user "That professor ID already exists"
    endif
    

    However, it doesn’t seem like a very logical system if you are duplicating professor details over and over when a professor has multiple subjects.

    Consider this DB structure:

    Table: professors

    Fields: id,firstname,lastname,gender

    Table: subjects

    Fields: id,professorid,subjectname,subjectcode

    With that, you would only maintain a single record in professors for each professor and the same for the subjects table. When you insert new subjects, you would populate the professor ID which links back to the professors table without duplicating data.

    This would be a simple structure that makes your database much more efficient, now depending on how complex your system needs to be you may need to normalise it even further. For example, if a subject can have multiple professors then you would not include a professor ID in the subject table, instead you would have a new table professor_subject_association with fields professorid, subjectid where you would link multiple professors to subjects.

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

Sidebar

Related Questions

I have Mac mini machine It has 10.3.9 Mac OS. Now I want to
I have an App (Mini file manager) on my phone that has a button
I have created a mini installer in NSIS that installs patches for my application.
A lot of these pages are like mini applications that have their own CSS
I have chosen diploma work in university. It's a mini social network. But now
I have a mini blog app, and a reply system. I want to list
I have a mini API that is only for an app I have built.
i have a mini blog app, and a 'timeline' . there i want to
I have a mini project that I'd like to start on port 2000. How
I have a micro-mini-search engine that highlights the search terms in my rails app.

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.