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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:12:44+00:00 2026-05-26T22:12:44+00:00

Let us say I have two different entities on a site. Teachers and Students

  • 0

Let us say I have two different entities on a site.

Teachers and Students.

They both login to the website.Right now I have the following tables

**Users**

 - id
 - email
 - password

**Students**

 - GPA
 - SAT
 - ACT
 - user_id references Users ID

**Teachers**

 - user_id references Users ID
 - classroom_no
 - salary
 - average_class_size

So when a Student registers I add a row in both the Users and Teacher table.

When a Teacher registers, I add a row in both the Users and Teacher table.

Is it better to just have ONE table Users with the following fields?

**Users:**

 - id
 - ACT
 - GPA
 - SAT
 - average_class_size
 - salary
 - classroom_no
 - role (0 = teacher 1 = student)

even though some rows would refer to teachers (and thus not use the ACT, SAT, GPA fields)

??

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-26T22:12:45+00:00Added an answer on May 26, 2026 at 10:12 pm

    If you are not familiar with database normalization, please read this.

    Unless performance is a serious issue, I would not look at using a single table for this structure. As your project goes one, you will more than likely add more fields to each role and possibly add more roles as well. It will become increasingly more difficult to maintain this.

    I would actually go a step further and introduce another concept called role into your application, along with the appropriate data model to persist it.

    Your tables should be:

    users:
     - id
     - email
     - password
    
    roles:
     - id
     - type
    
    user_roles:
     - user_id
     - role_id
    
    role_teacher:
     - user_id
     - classroom_no
     - salary
     - average_class_size
    
    role_student:
     - user_id
     - GPA
     - SAT
     - ACT
    

    Having a separate role table will let you separate your authentication table (users) from the rest of the data. This might become important if a user can be both a teacher and a student.

    This should give you a basic understanding of how to structure your database.

    You may find that you will begin to model some of the other concepts like classes in your system. So adding the appropriate tables may look something like:

    role_teacher:
     - user_id
     - salary
    
    classroom:
     - id
     - capacity
    
    class:
     - id
     - name
     - teacher_id
     - classroom_id
     - start_date
     - end_date
    
    class_enrollment:
     - class_id
     - student_id
     - enrollment_date
     - grade
    

    Items like the teachers class room now moves to the class, allowing for the teacher to teach multiple classes (maybe you need to re-add the concept of “home room”). The teachers average class size then just becomes a calculation (though you may want to still store it for the sake of efficiency).

    Hope this helps guide you in the right direction!

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

Sidebar

Related Questions

Let's say I have two different classes, both represent 2D coordinate data in the
Let's say I have two entities: Group and User. Every user can be member
OK so I have two entities in my data model (let's say entityA and
Let's say I have two different, distinct stack panels (we'll call them SPA and
Let's say you have two arrays of arrays with the same structure but different
Let say I have two different hashsets as shown below how can I check
Let's say you have two different categories of users with different profiles: one for
Let's say I have to compile two different versions of my .swf for different
I would need to have two different projects, let's say internal and external, which
So let's say I have two different functions. One is a part of the

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.