1 Star 0 Fork 48

张福川/SQL Server作业仓库

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
第八课.sql 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
邓德城 提交于 2021-03-21 17:36 . 邓德城第八次课作业
create database Student
go
create table Stuinfo2
(
StuSeat int,
StuName nvarchar(10) not null,
StuAge int,
StuSex nvarchar(1) default('1') check(StuSex in ('1','0')),
StuAddress nvarchar(200),
StuNo varchar(800) primary key
)
insert into Stuinfo2(StuNo,StuName,StuAge,StuAddress,StuSex)
values('s2501','张秋利','20','美国硅谷','1'),
('s2502','李斯文','18','湖北武汉','0'),
('s2503','马文才','22','湖南长沙','1'),
('s2504','欧阳俊雄','21','湖北武汉','0'),
('s2505','梅超风','20','湖北武汉','1'),
('s2506','陈旋风','19','美国硅谷','1'),
('s2507','陈凤','20','美国硅谷','0')
select * from Stuinfo2
create table Grade
(
ExamNo int identity(1,1),
stuNo varchar(800) references Stuinfo2(StuNo),
WrittenExam int,
LabExam int
)
insert into Grade(stuNo, WrittenExam,LabExam)
values('s2501', 50,70),
('s2502',60,65),
('s2503',86,85),
('s2504',40,80),
('s2505',70,90),
('s2506',85,90)
select StuSeat as 座位号, StuName as 姓名,StuAge as 年龄,StuSex as 性别, StuAddress as 地址,StuNo as 编号 from Stuinfo2
select StuName as 姓名,StuAge as 年龄, StuAddress as 地址 from Stuinfo2
select ExamNo as 学号, WrittenExam as 笔试, LabExam as 机试 from Grade
select 学号=ExamNo ,笔试=WrittenExam,机试=LabExam from Grade
select ExamNo 学号, WrittenExam 笔试, LabExam 机试 from Grade
select StuName+StuNo+StuAddress 邮箱 from Stuinfo2
select ExamNo + WrittenExam+ LabExam from Grade
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangfuchuang/sql-server-job-warehouse.git
git@gitee.com:zhangfuchuang/sql-server-job-warehouse.git
zhangfuchuang
sql-server-job-warehouse
SQL Server作业仓库
master

搜索帮助