摘要: create proc GetDataByName@nameasselect sno,cname,sname,scorefrom (student left join sc on student.sno=sc.sno)left join sxx on student.partno=sxx.partnowhere sxx.deparementname=student.snamewhere student.sname like @name+'%' 阅读全文
posted @ 2013-03-22 21:50 Utopiaes 阅读(220) 评论(0) 推荐(0)
摘要: create table student(sno int indetity(1,1) primary key,sname nvachar(10),[money] nvachar(10),departno int)create table sxx(departno int primary key,departname nvachar(10))create table sc(sno int,cname nvarchar(10),score nvarchar(10)primary key(sno,cname) //设置联合主键)alter student1 add constraint fk_stu 阅读全文
posted @ 2013-03-20 13:44 Utopiaes 阅读(215) 评论(0) 推荐(0)
摘要: 搞了几个小时才搞好 真的是要学习的太多了declare @index int set @index=1 //定义索引SELECT * FROM ( select row_number() over( order by sno) as //使用row_number()根据sno排序加编号row_number1,sno,[money],sname,score,cname from ( select student.sno,[money],sname,score,cname //多表查询出数据from (stu... 阅读全文
posted @ 2013-03-19 15:33 Utopiaes 阅读(136) 评论(0) 推荐(0)