Use SQL statements to create school databases (including parameters), tblclass tables, and tblstudent tables. And fill in the data.

Source: Internet
Author: User
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 ')

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.