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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:55:39+00:00 2026-05-24T04:55:39+00:00

I have 3 tables, student , parent , and staff with PK studentid ,

  • 0

I have 3 tables, student, parent, and staff with PK studentid, parentid, staffid respectively. I want to create a member table, with PK memberid, username, password. One member can be a student or parent or staff. I want to join this member table and member related table (if member is student, student table and so on) with a foreign key.

Currently I’m using another column for member type and put it as

1 for student, 
2 for parent and 
3 for staff, 

and doing program with php.

But I need another efficient way to create tables using relational structure.

  • 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-24T04:55:40+00:00Added an answer on May 24, 2026 at 4:55 am

    I assume you are using MySQL, but other DBMS may be similar.

    There is no way to do what you are asking with a single column or table. You have a few options to implement this using relational databases:

    Option 1: Have your member table include three columns with relational constraints to the staff, parent and student tables. A user’s type is implied by which column is filled (leave the others NULL)

    Option 2: Put the data you want to store on each member on the staff, parent and student tables (like the username and password)

    Each has its own downsides, the first being you will have to check each column to find out what type of member the current individual is and join the correct table, or search three tables when you need log someone in. There is also not single pool of memberid‘s for your members. (You could do something similar to what @Sherif suggested)

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

Sidebar

Related Questions

I have three tables. The designs were like student table create table student (studID
Assume I have two tables, Student Test Id Name TestId Type StudentId -- ----
I have two tables associated by FK. Table student is mapped like this: @Entity
I have bind 2 separate tables using BindingSource. Left grid contains student table and
I have 3 tables Student Loan Book - StudentID LoanID BookID which foreign keys
Suppose I have the following two tables: STUDENT studentid lastname firstname 1 Smith John
I have 3 tables in my SQL Server database: Teacher Student Parent Each of
I have 3 tables Student, Course, and the linking table StudentCourse, how do i
I have a list of tables i.e. student, teacher, staff, dept. and so on
I have two table Parent Table STUDENT ====> ID,NAME SqlCommand==>Select * from Student Child

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.