好久没用SQL数据库了,而且也没有环境测试语句,没装数据库,而且题目中,数据库的表名,字段都没说清楚,可能有的语句会有错误,不过加点修改应该没问题,答案如下: (1 select xuehao from t_student where xuehao=00000003 and xuehao=00000013 and xuehao=00000023 '表名、字段名不明,表名用t_student,学号用xuehao替代 (2 select count(banji) as 班级汇总 from t_student '表名、字段名不明,表名用t_student,班级用banji替代了 (3 use XK go insert into class(c_number,c_name,c_xibu) values ('9000001','08数据库','01') 'c_number,c_name,c_xibu分别为班级代码,班级名称,系部代码 (5 create proc P_counum @xibu int AS select t_xibu.xibu_name, count(*) from t_xibu, where t_xibu.xibu_name=@xibu '不知道数据库的表名,字段名,所以定义t_xibu是表名,xibu_name是字段名 (6 use XK go create trigger T_UpdateStu for update as raiserror('记录已更新',16,10) 测试: update t_student set xuehao=00000033 where xuehao=00000003 '表名、字段名不明,故表名用t_student 追问: 应该不会错的把? 追问: 第四题 有吗? 回答: 第四题不是有了嘛: create view V_StuByDepselect XK.studentfrom XKwhere 。。。。。看具体要求,题目也没讲清楚,“ 计算机应用 工程系学生信息”我用student替代了。 追问: 没有啊,你可以写一下嘛?帮帮忙,老兄!!
(1)答案:select * from xk..表名 where 学号(字段名) in ('00000003','00000013','00000023'), (2) 答案: select count(a.班级) 班级个数 from (select distinct 班级(字段名,一般是班级ID) from xk..student ) a (3) 答案: insert int xk..class(班级代码(字段名),班级名称,系部代码) values('9000001','08数据库','01') (4) 答案: if exists(select * from sysobjects where name='V_StuByDep') drop view V_StuByDep go create view V_StuByDep as select * from xk..学生表 where 系部代码=(select 系部代码 from xk..系部信息表 where 系部名称='中计算机应用工程系') (ps:这事我根据你题目意思理解的,应该还有一个系部细细表吧,差不多就是简单的复合查询 ) (5) 答案: create proc P_counum @xibu varchar(20) AS select * from xk..课程表 where 系部代码=(select 系部代码 from xk..系部信息表 where 系部名称='中计算机应用工程系') (6) 答案: create trigger T_UpdateStu for update as print '记录已更新' ps:(同学,好好学习)