sql的题实在不会做,请各位大哥帮忙做一做?(有一题不会做SQL 求大神做下答案)
有一题不会做SQL 求大神做下答案
恩 ,,没问题
大哥,帮帮我吧! 帮我做做SQL题目吧.
MSSQL
【1】
select * from employ
【2】
select department_name from departments d join employ e
on d.department_id=e.department_id
where e.employee_id=2
【3】
select pro_id from professions where pro_name='教授'
【4】
select employee_name,employee_address from employ
where employee_id>18
【5】
select employee_name,employee_salary from employ
where employee_age>18 and department_id=2
【6】
select employee_name,employee_salary,employee_address from employ
where employee_age>18 or department_id=2
【7】
select employee_name,employee_age from employ
order by employee_salary desc
【8】
select * from employ
where employee_salary>1000
order by employee_salary desc
【9】
select employee_name,employee_salary from employ
where employee_salary<2001
order by employee_salary
【10】
select top 5 * from employ
order by employee_salary desc
【11】
select top 10 employee_name,employee_address from employ
order by employee_age
【12】
select * from employ
where employee_age>20
order by employee_age
【13】
delete from emp_pro
【14】
delete from emp_pro
where emp_pro.employee_id in (select e.employee_id from employ e where e.employee_age>20)
delete from employ where employee_age>20
【15】
delete from emp_pro
where emp_pro.employee_id in (select e.employee_id from employ e where e.employee_salary<2001)
delete from employ where employee_salary<2001
【16】
update departments set department_name='一部' where department_id=1
【17】
update employ set employee_salary=2000 where employee_salary<2000
【18】
update employ set employee_salary=employee_salary+1000 where employee_salary<2000
【19】
insert into employ(employee_name,employee_age) values('李四',10)
【20】
insert into departments (department_id,department_name) values(6,'工商六部')
求人帮助我,有SQL的题目不会做,求帮助。重谢
做题还是SQL语句哦
帮忙做几道数据库的题,最好能快点·200分送上
create table S(s_no varchar(10),s_name varchar(10),dp_name varchar(20),s_sex varchar(2),s_birthdate datetime)
create table C(c_no varchar(20),c_name varchar(20),t varchar(10))
create table SC(s_no varchar(10),c_no varchar(20),score varchar(3))
insert into s values('201','黎明 ','计算机','男',1992)
insert into s values('202','名人','计算机','男',1993))
insert into s values('203','李丽','数学','女',1992))
insert into s values('204','王明','计算机','男',1992))
insert into s values('205','田七','英语','女',1991))
insert into c values('1','政治','李明')
insert into c values('2','计算机应用基础','刘老师')
insert into c values('3','数学','王老师')
insert into c values('4','数据库','刘老师')
insert into c values('5','数据库原理及应用','王老师')
insert into sc values('201','1','80')
insert into sc values('201','3','45')
insert into sc values('201','2','50')
insert into sc values('202','1','80')
insert into sc values('202','2','90')
insert into sc values('202','3','60')
-----
一,
1.select * from s where year(GetDate())-year(s_birthdate)<20
2.select count(*) from sc ,c where sc.c_no=c.c_no and c.c_name='数据库'
3.select s.s_name,s.s_no,c.c_name,sc.score
from s,c,sc where s.s_no=sc.s_no and c.c_no=sc.c_no and c.c_name='数据库原理及应用'
4.select s.s_no from s,sc
where s.s_no=sc.s_no and sc.c_no in('1','3')
5.select s_no,s_name,year(GetDate())-year(s_birthdate) sage
from s where year(GetDate())-year(s_birthdate) between 18 and 20
6.每张表中值可创建1个聚集索引,非聚集索引的个数没有限制
二,
1.黎明不及格的科目名
select c.c_name from s,c,sc
where s.s_no=sc.s_no and c.c_no=sc.c_no and sc.score<60 and s.s_name='黎明'
黎明不及格的科目数
select count(*) from s,c,sc
where s.s_no=sc.s_no and c.c_no=sc.c_no and sc.score<60 and s.s_name='黎明'
2.select s.s_no,s.s_name,sum( 数学+计算机应用基础+政治) sumscor
from table1 group by s.s_no,s.s_namer
order by sum( 数学+计算机应用基础+政治)