sql - Create a new table with each new record -
i building hospital management system , wanted make table in database contains hospitals. each hospital has table contains info employees.
if wanted add new record (a new hospital) in hospital table after system released, can system generate new table new hospital's employees?
it have standard form , system ask user fill (through gui, or other way).
is technically possible? , if not there other ways it?
first should read table relationships. it's important understand how works before desgnining database.
now question, tables don't contain tables. why should review design.
you should have tables :
hospital --------------------------------------------------- | id | name | address | phone | --------------------------------------------------- | 1 | somename | 13 mercy street | 555-555-5555 | --------------------------------------------------- employee ------------------------- | id | hospital_id | name | ------------------------- | 01 | 1 | john | -------------------------
this way every employee associated hospital. know john works in somename hospital.
to in research,
- hospital.id primary key
- employee.id primary key
- employee.hospital_id foreign key
Comments
Post a Comment