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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:04:26+00:00 2026-05-22T01:04:26+00:00

Still working on a web application as a school project, and it just seems

  • 0

Still working on a web application as a school project, and it just seems to keep expanding.

I have to add a layer for teachers so they can manage and coach students through the application. So, I have to link teachers to their students.

I was wondering what the best way would be to do this. I have one table for all users at the moment. The bare basics of this table are:

id | email | firstname | lastname | role
1  | s@s.s | dromiceio | mimus    | 1
2  | d@d.d | tyranno   | saurus   | 2
3  | a@a.a | utah      | raptor   | 1

Role is the number I assign to them to give them certain permissions. 1 = student, 2 = teacher, 3 = admin.

Assuming that one student has one teacher but one teacher has many students, what would be the best way to design my database table?

I was thinking of creating a new table and just putting the student/teacher ids in it:

For example, if teacher Tyranno Saurus (id 2) has the two students in the table above linked to him, I would make a table like this:

pk_id | teacherid | studentid
  1   |     2     |     1
  2   |     2     |     3

That way, I would know that teacher Tyranno (id 2) has two students, namely the student with userid 1 and userid 3.

Then again, I have never really worked on anything like this so I was wondering if anyone could give me some insight about this and if it’s possible to do this in a better way.

I’m building my app in PHP (CodeIgniter) with MySQL; if that’s of importance.

Thanks a lot.

  • 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-22T01:04:27+00:00Added an answer on May 22, 2026 at 1:04 am

    If a student has zero-or-one teacher coaching them, then I would suggest adding a CoachID column to the student table that is a foreign-key to that particular teacher. The intermediate table you’ve suggested doesn’t do anything to simplify this simple relationship, it actually makes it that little bit more complicated.

    If you were tying students to classes (where each class has multiple students and each student takes multiple classes) then an intermediate many-to-many mapping table would be a must.

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

Sidebar

Related Questions

I'm working on a Web project using Asp.Net MVC, which I'll have to deploy
I have 2 login controls on a web application one on default and one
I am working with a web application that is designed to run on IE
My JavaFX app is working when executed via the JavaFX Eclipse plugin. But when
I have installed Ruby 1.9.1 recently. Everything went fine, I installed the devkit, gems,
I am attempting to send html data in a question form from my php
I'm using the Windows Identity Foundation (WIF) Security Token Service (STS) to handle authentication
I'm getting this error (see title) while trying to parse an XML file in
Here is a description of the scenario and I would appreciate also any comments
When using Session.SaveOrUpdate(myEntity); how does NHibernate decide how whether to insert a new record

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.