---恢复内容开始---
查询有几个不同的职位名称:
select distinct name from a;
group by:
现在有两个表product和sales,字段分别如下:
TABLES:product
字段:id(产品id)、Name(产品名称)
TABLES:sales
字段:id(销售id)、product_id(产品id)、DATE(日期)、amount(销售数量)
1、修改产品D的产品名称为E
update product set Name=E where Name=D ;
2、插入产品名称为“产品E”的产品数据;
insert into table(product) field(产品E);
3、删除产品名称为"产品E"的数据;
delete from product where Name = 产品E;
4、查询2014-1-1至2014-1-3期间单日销售数量大于110的产品;
select name from product a, sales b where a.date > 2014.1.1 and < 2014.1.3 b.amount >110;
5、查询销售总量最多的产品名称;
select Name from product a,sales b where amount=max(amount);
6、查询每种分类的总和:查询每种产品的销售总量;
select sum(amount) from product a, sales b group by b.proudct_id;
7、查询销售总量大于300的产品;
select id Name from product a right join sales b where having sum(amount)>300;
---------------------------------------------------------
1、查询多少个产品;
select distinct Name from product;
2、统计产品的个数;
select count(distinct name) from product;
linux | LR | sql | UFT/QTP | 电脑常识 |
---恢复内容结束---
查询有几个不同的职位名称:
select distinct name from a;
group by:
现在有两个表product和sales,字段分别如下:
TABLES:product
字段:id(产品id)、Name(产品名称)
TABLES:sales
字段:id(销售id)、product_id(产品id)、DATE(日期)、amount(销售数量)
1、修改产品D的产品名称为E
update product set Name=E where Name=D ;
2、插入产品名称为“产品E”的产品数据;
insert into table(product) field(产品E);
3、删除产品名称为"产品E"的数据;
delete from product where Name = 产品E;
4、查询2014-1-1至2014-1-3期间单日销售数量大于110的产品;
select name from product a, sales b where a.date > 2014.1.1 and < 2014.1.3 b.amount >110;
5、查询销售总量最多的产品名称;
select Name from product a,sales b where amount=max(amount);
6、查询每种分类的总和:查询每种产品的销售总量;
select sum(amount) from product a, sales b group by b.proudct_id;
7、查询销售总量大于300的产品;
select id Name from product a right join sales b where having sum(amount)>300;
---------------------------------------------------------
1、查询多少个产品;
select distinct Name from product;
2、统计产品的个数;
select count(distinct name) from product;
linux | LR | sql | UFT/QTP | 电脑常识 |