资源预览内容
第1页 / 共11页
第2页 / 共11页
第3页 / 共11页
第4页 / 共11页
第5页 / 共11页
第6页 / 共11页
第7页 / 共11页
第8页 / 共11页
第9页 / 共11页
第10页 / 共11页
亲,该文档总共11页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
信息数据应用实验报告实验5数据库查询(I)实验日期2011-10-26学生姓名11学号2010201245数据准备:use master;gocreate database MyDB;goUSE MyDB;gocreate table class(ID char(3) primary key,name nvarchar(10) not null);goinsert into class values(A01,08信管);insert into class values(A02,09信管);insert into class values(A03,10信管);gocreate table student( ID int identity(1,1) not null, sex nchar(1) not null, classID char(3) not null, score int, birthday datetime, constraint zhujian primary key(ID), constraint scorecheck check(score=0 and score=70 and score=0 and score=100);goinsert into student values(王小屁,男,a04,90,1992/02/29);insert into student values(王大屁,男,a02,21,1991/05/20);insert into student values(王臭屁,男,a01,59,1990/01/01);insert into student values(唐小尧,男,a03,87,1989/02/28);insert into student values(王屁屁,女,a03,100,1987/12/31);goselect* from student;结果-(1) 修改查询结果的列标题名称select stuID as 学号,stuName as 姓名,score as 成绩from student;结果:select stuID as 学号,stuName as 姓名,score as 成绩,datename(year,birthday)+年+datename(month,birthday)+月+datename(day,birthday)+日as 生日from student;go结果-
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号