二)实施工程师数据库部分
14.触发器的作用是什么?
触发器的是针对数据库的特殊的存储过程,当这个表发生了Insert,Update或Delete操作时,数据库都会自动执行触发器所定义的SQL语句,从而确保数据库的处理必须符合这些SQL语句所定义的规则
15.数据库:抽出部门,平均工资,要求按部门的字符串顺序排序,不能含有“human resource”部门,
Employee 结构如下:employee_id,employee_name,
dpart_id,depart_name,wage
答: select depart_name,avg(wage)
from employee
where depart_name<> ‘human resource’
group by depart_name
order by depart_name
16.给定如下SQL数据库:Test(num int(4))请用一条SQL语句返回num最小值,但不许使用统计功能,如min,max等
答:select top 1 num from Test oder by num
17.一个数据库中有两个表
一张表为Customer,含有字段ID,Name;
一张表为Order,含字段ID,CustomerID(连向Customer中的ID的外键),Revenue;
写出求每个Customer的Revenue总和的SQL语句
建表 create table customer
(
ID int primary key,Name char(10)