4、查询举例
1、简单查询
SELECT 工资 from 职工表;
SELECT * from 仓库表;
2、条件查询
SELECT 工资 from 职工表 where 工资>1230;
SELECT * from 职工表 where 工资<1230 and (仓库号="WH1" or 仓库号="WH2");
SELECT * from 职工表 where 工资 between 1220 and 1240;
SELECT * from 职工表 where 工资 not between 1220 and 1240;
3、排序查询
SELECT * from 职工表 order by 工资;
4、汇总计算查询
SELECT Count(*) AS 职工总数 FROM 职工表;
SELECT sum(工资) AS 工资总额 FROM 职工表;
SELECT avg(工资) AS 平均工资 FROM 职工表;
5、分组查询
SELECT 职工表.仓库号, Avg(职工表.工资) AS 平均工资 FROM 职工表 GROUP BY 职工表.仓库号;
6、操作查询
insert into 订购单表 values ("e7","s4","or01","2001-05-25");
delete from 订购单表 where 订购单号="or01";
update 订购单表 set 供应商号="s6" where 订购单号="or67";