延续前两天的学习,先说前面利用脚本创建数据库,代码应当牢记,多加练习。
数据库的创建以及数据表的创建都是最基础的东西,应该牢记于心。
今日学习数据表中数据的增加----insert
create table ClassInfo
(
CId int not null primary key identity(1,1),
CTitle nvarchar
)
--为了验证实际效果,首先查看数据表中列的情况
select * from ClassInfo
--在ClassInfo数据表中插入数据
insert ClassInfo(CTitle)
values('12')
--实际效果应该在CTitle这个列中插入了12这个数据,cid中的数据是系统所给
--为了验证其他数据的插入,此处再创建一个数据表
create table StudentInfo
(
sId int not null primary key identity(1,1),
sName nvarchar(10) not null,
sGender bit default(0),
sPhone char(11)
)
insert StudentInfo(sName,sGender,sPhone)
values('李四',0,'12345678'),('王五',0,'123455678')