Second, lesson two
CREATE TABLE Teacher
(
TNO int PRIMARY KEY identity (TNO), -- set the primary key (primary key identity )
Tname varchar (50)
)
Go
Insert into Teacher Values (' Zhang San ')
Insert into Teacher Values (' John Doe ')
Insert into Teacher Values (' Harry ')
Go
Select * from Teacher
Go
Delete from Teacher where tname=' Harry '
--- query
Select * from player where name=' Yorick '
--selset *( All) from table where condition
Select * from chinastates where parentareacode=37 and root=1
--and and or or >= <=
Use Player
CREATE TABLE Xueshengxinxibiao
(
TNO int PRIMARY KEY identity (primary), -- set the primary key to 1, starting at 1 per increment
name varchar (50),
Sex int,
Age int,
cm decimaL (18,2),
kg decimal (18,2),
Idcard bigint,
addresss varchar (50),
)
Insert into Xueshengxinxibiao Values (' Liu Kai ', 1,23,172,65,372328199206190313,' Zhangdian District, Zibo, Shandong province ') --The primary key word is automatically generated (the identity), not the input
Insert into Xueshengxinxibiao Values (' yorick ', 1,23,172,65,372328199206190313,' Zhangdian District, Zibo, Shandong province ')
Insert into Xueshengxinxibiao Values (' 111 ', 1,23,172,65,372328199206190313,' Zhangdian District, Zibo, Shandong province ')
Insert into Xueshengxinxibiao Values (' 222 ', 1,23,172,65,372328199206190313,' Zhangdian District, Zibo, Shandong province ')
Select * from Xueshengxinxibiao
Update Xueshengxinxibiao Set name=' wu Zhuang guan ' where tno=3 -- put tno=3 change the line to name= ' Five Zhuang Guan '
Database-based primary key and where application