Istiyak Sheyam
Istiyak Sheyam

Reputation: 15

How to create database table based on the type of the users

I have two types of users. For example:

  1. Male 2 Female

Now I have created a table of 'users' that holds all the common information and 'males' and 'females' will hold specific information related to those.

Now my question is how to create the table for males and females. Do they will hold the user_id column. If so, then hypothetically, a user can have multiple male or female accounts. How to solve this issue?

Upvotes: 0

Views: 159

Answers (1)

Abdullah Mamun
Abdullah Mamun

Reputation: 11

Why don’t you just add a column, ‘gender’, in the users table? It will take just 1 character to describe if a person is male (‘M’) or female (‘F’).

If you insist on creating a new table anyway, you can define the user_id column as unique in the new table and it should be a foreign key that refers to the user_id column of the users table.

Upvotes: 1

Related Questions