Use SQL statements to create school databases (including parameters), tblclass tables, and tblstudent tables. And fill in the data.
Create a school database (including parameters)
Create Database School
On Primary
(
Name = 'school ',
Filename = 'f: \ SQL Server \ school. MDF ',
Size = 10 MB,
Filegrowth = 10,
Max size = 100 MB
)
Log On
(
Name = 'school _ log ',
Filename = 'f: \ SQL Server \ school_log.ldf'
)
Tblclass table:
Create Table tblclass
(
CLSID int identity (1, 1) primary key,
Clsname nvarchar (50) not null,
Clsdiscription nvarchar (50)
)
Insert into tblclass (clsname, clsdiscription) values ('one-to-one class', 'quickshift ')
Insert into tblclass (clsname, clsdiscription) values ('first Class 2 ', 'middle class ')
Insert into tblclass (clsname, clsdiscription) values ('high one three class', 'slow class ')
Insert into tblclass (clsname, clsdiscription) Values ')
Insert into tblclass (clsname, clsdiscription) values ('second class 2', 'middle class ')
Insert into tblclass (clsname, clsdiscription) values ('high school three class', 'slow class ')
Tblstudent table:
Create Table tblstudent
(
Stuid int identity (1, 1) primary key,
CLSID int not null, -- class foreign key
Stuname nvarchar (50) not null,
Stuage int not null,
Stuno numeric (), -- ID card number, 18 digits
Stugender bit not null default (1 ),
Stuemail varchar (50 ),
Stubirthday datetime
)
Insert into tblstudent (CLSID, stuname, stuage, stugender, stuno, stubirthday) values (1, 'Liu bei ', 20, 1, 123456789012345678, '2014-5-6 ')
Insert into tblstudent (CLSID, stuname, stuage, stugender, stuno, stubirthday) values (1, 'guan Yu ', 123456789012345671, 1988, '2017-8-6 ')
Insert into tblstudent (CLSID, stuname, stuage, stugender, stuno, stubirthday) values (1, 'zhang fe', 123456789012345672, 1989, '2017-5-19 ')
Insert into tblstudent (CLSID, stuname, stuage, stugender, stuno, stubirthday) values (4, 'caocao', 123456789012345673, 1985, '2017-12-6 ')
Insert into tblstudent (CLSID, stuname, stuage, stugender, stuno, stubirthday) values (4, ' ', 123456789012345674, 1985, '2017-3-6 ')
Insert into tblstudent (CLSID, stuname, stuage, stugender, stuno, stubirthday) values (4, 'huawei', 50, 1, 12345678901234565, '2017-1-16 ')
Insert into tblstudent (CLSID, stuname, stuage, stugender, stuno, stubirthday) values (4, 'ji Ji ', 12345678901234565, 1989, '2017-8-8 ')