I have to experience a bit: an example of creating a database

xiaoxiao2021-03-06  13

Two tables are requested to create a Doctor and CaseTable, where the Doctor primary key DOC_ID, the CaseTable primary key (admin) is otherwise restricting the DOC_ID in CaseTable is the foreign key of the Doctor. The method is as follows: Knowledge points: 1 Create order, because there are foreign key quotation, so Docotor creates first, CaseTable 2 I am not necessarily in this table.

Create Table Doctor (DOC_ID VARCHAR (9) Not Null Primary Key (DOC_ID), FName Varchar (20), Lname Varchar (25), Specialty Varchar (25), Phone Varchar (10),)

create table Casetable (admission_date datetime not null, pat_id varchar (9) not null, doc_id varchar (9) not null FOREIGN KEY REFERENCES doctor (doc_id), diagnosis nvarchar (150), constraint case_key PRIMARY KEY (admission_date, pat_id))

转载请注明原文地址:https://www.9cbs.com/read-50239.html

New Post(0)