3.5 Create the drug table, the drug code is the main code, the lot number is unique Create table medicine (Medicinecode char) primary key,medicinename varchar (Pycode char), Dosagefrom char (Ten), Standard char (), Batchnumber char ( unique,productiondate date,expirationdate date,category char (+), Yb char (10)); 3.7 Create a Vendor table, the main code is a table-level constraint Create table provider (Providercode char (4) not null,providername char ( not null,pycode char), Address char (6), Tel char (Zip char) ), Email char (+), Relation char (8), Primary key (Providercode)-Main code constraint, table-level constraint), 3.8 set up the supply table, including the main code, external code, are tag constraints create table pm (Medicinecode char) not null,providercode char (4) Not null,pmdate date not null,price number, qyt int,primary key (Medicinecode,providercode,pmdate), Foreign key (Medicinecode) references medicine ( Medicinecode), Foreign key (prOvidercode) References provider (Providercode));
Attention:
Column-level constraints: There are spaces separated before the constraint conditions;
Table-level constraints: As with defining attributes, make a single sentence, ending with a comma!
This article is from the "Sanghaidan blog column" blog, please be sure to keep this source http://10602803.blog.51cto.com/10592803/1683064
Create basic table, database, column-level/table-level constraints