Use Mastergoif EXISTS (SELECT name from sys.sysdatabases WHERE name = ' STUDENT ') DROP database studentgocreate database STUD Entgouse studentgocreate table Member (MID CHAR (Ten) PRIMARY KEY, Mname CHAR (not NULL) gocreate table F (FID char) PR Imary Key, FName char (a) not NULL) Gocreate TABLE score (SID INT IDENTITY () PRIMARY key, FID CHAR (Ten) FOREIGN key (FID) REFERENCES F (FID), Mid CHAR (Ten) FOREIGN KEY (mid) REFERENCES Member (mid), score INT not NULL) Goinsert into dbo. Member (MID, Mname) VALUES (' M001 ', ' Zhang San ') INSERT into dbo. Member (MID, Mname) VALUES (' M002 ', ' John Doe ') INSERT into dbo. Member (MID, Mname) VALUES (' M003 ', ' Harry ') INSERT into dbo. Member (MID, Mname) VALUES (' M004 ', ' Zhao Liu ') INSERT into dbo. Member (MID, Mname) VALUES (' M005 ', ' small Seven ') INSERT into dbo. Member (MID, Mname) VALUES (' M006 ', ' Forest One ') INSERT into dbo. Member (MID, Mname) VALUES (' M007 ', ' including ') INSERT into dbo. Member (MID, Mname) VALUES (' M008 ', ' Mountain Mountain ') INSERT into dbo. Member (MID, Mname VALUES (' M009 ', ' Tian Li ') INSERT into dbo. Member (MID, Mname) VALUES (' M010 ', ' Liu Kai ') INSERT into dbo. F (FID, FName) VALUES (' F001 ', ' language ') INSERT into dbo. F (FID, FName) VALUES (' F002 ', ' math ') INSERT into dbo. F (FID, FName) VALUES (' F003 ', ' English ') INSERT into dbo. F (FID, FName) VALUES (' F004 ', ' history ') insert into score (Fid,mid,score) VALUES (' F001 ', ' M001 ', +) insert INTO score (Fid,mid, Score) VALUES (' F002 ', ' M001 ', ") insert into score (Fid,mid,score) VALUES (' F003 ', ' M001 ',") insert into score (Fid,mid, Score) VALUES (' F004 ', ' M001 ', *) insert INTO score (Fid,mid,score) VALUES (' F001 ', ' M002 ', and ",") insert into score (Fid,mid, Score) VALUES (' F002 ', ' M002 ', ') insert into score (Fid,mid,score) VALUES (' F003 ', ' M002 ', ' + ') insert into score (Fid,mid, Score) VALUES (' F004 ', ' M002 ', ') insert into score (Fid,mid,score) VALUES (' F001 ', ' M003 ', ") insert into score (Fid,mid, Score) VALUES (' F002 ', ' M003 ', and all) insert into score (Fid,mid,score) VALUES (' F003 ', ' M003 ', ") insert into score (Fid,mid, Score) VALUES (' F004 ', ' M003 ', *) INSERT into SCore (Fid,mid,score) VALUES (' F001 ', ' M004 ', ') insert into score (Fid,mid,score) VALUES (' F002 ', ' M004 ', +) insert INTO Score (Fid,mid,score) VALUES (' F003 ', ' M004 ',) insert INTO score (Fid,mid,score) VALUES (' F004 ', ' M004 ', $) insert into Score (Fid,mid,score) VALUES (' F001 ', ' M006 ',) insert INTO score (Fid,mid,score) VALUES (' F002 ', ' M006 ', ") insert INTO Score (Fid,mid,score) VALUES (' F003 ', ' M006 ',) insert INTO score (Fid,mid,score) VALUES (' F004 ', ' M006 ', ") insert INTO Score (Fid,mid,score) VALUES (' F002 ', ' M007 ',) insert INTO score (Fid,mid,score) VALUES (' F003 ', ' M008 ', +) insert INTO Score (Fid,mid,score) VALUES (' F004 ', ' M007 ',) insert INTO score (Fid,mid,score) VALUES (' F004 ', ' M009 ', ") insert INTO Score (Fid,mid,score) VALUES (' F002 ', ' M009 ', 88)
Student scores create tables and databases