SQL Server数据中运算符与表达式
这是个大题呀
a)
relationship:PARTICIPATED (acc-number, driver-id, regno, damage-amount)
bridge entities: DRIVER (driver-id, name, address) ACCIDENT (acc-number, location, date)
relationship:OWES (driver-id, regno)
bridge entities:CAR (regno, year, model) DRIVER (driver-id, name, address)
relationship:WORKS (employee-name, department-name, salary)
bridge entities:EMPLOYEE (employee-name, street, suburb) DEPARTMENT (department-name, suburb)
以下D 表示关系代数的选择操作符,P表示投影,*表示自然连接
b)
P employee-name (D department-name ="Marketing” (EMPLOYEE))
select employee-name from EMPLOYEE where department-name =“Marketing”
c)与b)类似
d)
Pemployee-name , street, suburbs (D department-name =“Marketing” (EMPLOYEE)*D salary>10000 and department-name =“Marketing” (WORKS) )
select employee-name , street, suburbs
from EMPLOYEE, WORKS
where EMPLOYEE.employee-name= WORKS.employee-name and WORKS.department-name =“Marketing” and EMPLOYEE.department-name =“Marketing” and WORKS.salary>10000
e)
P employee-name (D EMPLOYEE.suburb= DEPARTMENT. suburb (EMPLOYEE * DEPARTMENT ))
Select employee-name
From EMPLOYEE, DEPARTMENT
Where EMPLOYEE. department-name= DEPARTMENT.department-name and EMPLOYEE.suburb= DEPARTMENT. suburb
f)英语不好,没看明白
g)
update WORKS set salary=1.1*salary
where department-name= “Marketing”
h)
update WORKS set salary=1.1*salary
where department-name= “Marketing” and employee-name in (select manager-name from MANAGES)
i)
select employee-name , sum(salary)
from WORKS
group by employee-name
j)
select employee-name , sum(salary)
from WORKS
where department-name= “Marketing”
group by employee-name
having sum(salary)>10000
k)
select employee-name , sum(salary)
from WORKS
where department-name= “Marketing”
group by employee-name
having sum(salary)>(select avg(ts) from (select sum(salary) ts
from WORKS
group by employee-name) )
对不起啊同学,我完全没看懂。。。。。。。o(╯□╰)o 看楼下的吧