表中信息:
CREATE TABLE student
(
Sno char(12) PRIMARY KEY,--主码
Sname varchar(20) NOT NULL,--Sname不为空
Ssex char(4) CHECK( Ssex = '男' OR Ssex = '女'),
Sage SMALLINT,
Sdept varchar(20) NOT NULL,
);
GO
INSERT INTO student VALUES('20102001',' 阎妮','女','19', '自动化与软件学院');
INSERT INTO student VALUES('20102002',' 张有来','男','19','文学院' );
INSERT INTO student VALUES('20102003',' 王文喜','男', '20','软件工程');
INSERT INTO student VALUES('20102004',' 赵敏','女','21', '电力与建筑学院');
INSERT INTO student VALUES('20102005',' 罗莎','女','18', '软件工程');
INSERT INTO student VALUES('20102006',' 蒙恬','男','20', '软件工程');
GO
查询代码:
SELECT Sno,Sname,Ssex
FROM student
WHERE Sname = '王文喜';