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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:03:59+00:00 2026-05-31T01:03:59+00:00

I need help to model a table structure for my database. I have two

  • 0

I need help to model a table structure for my database.

I have two tables: teacher and student. And to deal with authentication, I have
another table called: user. I want to maintain the information about teacher and
student separated of the information about login (user table).

For example:

     teacher
-----------------
|  id |   name  |
-----------------
| 10  |  lorem  |
| 20  |  ipsum  |
| 30  |  dolor  |
-----------------


    student
-----------------
|  id |   name  |
-----------------
|  5  |  amet   |
|  6  |  sitt   |
|  7  |  dolum  |
-----------------

Information separated in two tables.
The user table:

     user
-----------------------------------------------------------------
|  id |   teacher_id  |  student_id |    login   |   password   |
-----------------------------------------------------------------
|  1  |     10        |             |  lorem_lo  |   *******    |
|  2  |     20        |             |  ipsum_lo  |   *******    |
|  3  |     30        |             |  dolor_lo  |   *******    |
|  4  |               |     5       |  amet_lo   |   *******    |
|  5  |               |     6       |  sitt_lo   |   *******    |
|  6  |               |     7       |  dolum_lo  |   *******    |
-----------------------------------------------------------------

The solution I thought was that. I ask your opinion about.
Is that a good solution?

Thanks in advance.

P.S.: I’m using Mysql (InnoDB)

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

    To eliminate empty fields from user table, you can do this:

    --------------------------------------------------
    |  id  |  user  |  level  |  login  |  password  |
    --------------------------------------------------
    

    where user contains all your students and teachers ID’s and level that contains 1 for teachers and 2 for students.

    In this case, you can use level column to create access in your app.

    Another method, is with one table… separate students and teacher trough levels but isn’t best practice.

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

Sidebar

Related Questions

I need help with a problem regarding data saved in a parent-children model table
Need help figuring this out. Have a product model: class Product :name :short_description :price
I need help with PHP PDO and SQLITE3. I have table device like CREATE
Need your help, strange. I have the same tables based locally and on the
let's say i have table with this structure: id model color ------ -------- ----------
Hello I need help with displaying data from 2 table. So i Have 2
i need help with disk_total_space function.. i have this on my code <?php $sql=select
I need some help over here to understand how the model relationship works on
forum member I need one help from you all. I am having two POJO
I have a scenario in which I think I need to lock a 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.