php - How to create a table for a table in phpmyadmin? -


i having hard time thinking how create or have table/s members going join table room. have 2 kind of members

  • holder - 1 creates room
  • member - 1 join room room_code.

how can create table members in room?

table members:

  • member_id
  • member_type
  • member_name
  • member_username
  • member_password

table room:

  • room_id
  • room_name
  • room_code
  • room_section
  • room_desc
  • room_holder_id
  • room_limit
  • date_created

the design of table going depend lot on requirements need fulfilled.

in situation member can ever assigned single room, rooms can have many members, answer double h gave you're looking for:

create table members (  member_id int,  member_type varchar,  member_name varchar,  member_username varchar,  member_password varchar,  room_id int foreign key references room(room_id) ) 

now, if member participate in more single room, , rooms can have more single member, start getting off other types of relationships (e.g. many-to-many).

the mysql documentation textbooks (e.g. library) can jobs of explaining different types of relationships inside rdbms (relational database management system). understanding logical way tables joined key step before understanding how physically join them in database (like, example, through phpmyadmin).

for implementation details of many-to-many relationship, there many resources online including 1 pinal dave: many-to-many relationships. explains third table necessary make relation.


Comments

Popular posts from this blog

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -