你好,你需要给出表结构才能给你写出sql。
追问那个表很多都是空的from我你直接用*代替就好了其他的给我写下!
追答--1、显示订单表中所有的信息。
select * from 订单表;
--2、列出所有中止供应的产品。
select * from 产品表 where status = '中止';
--3、列出所有总订购量为0的产品。
select * from 产品表 where not exsits(select id from 订单表 where 产品表.id = 订单表.id);
--4、列出客户表中所有客户的联系人姓名和所在公司以及地址。
select * from 客户表;
--5、列出产品表所有产品的名称、库存量和单价。要求产品名称前面插入“名称:”,且更改默认的库存量列标题为产品库存量。(注意:不是修改表记录)。
select '名称:' + 名称,库存量 as 库存量,单价 from 产品表;
--6、列出订单表中所有华东地区的订单
select * from 订单表 as a,客户表 as b where a.id = b.id and b.地址 = '华东' ;
--7、列出库存量小于10的所有产品
select * from 产品表 where 库存 < 10;
--8、列出所有货主邮政编码“05”开始的订单ID。
select id from 订单表 as a,货物表 as b where a.id = b.id and b.id like '05%'
--9、列出库存量不在60和80之间的所有产品。
select * from 库存表 where 库存量 > 80 and 库存量 < 60;
--10、列出订单表中所有华东地区的订单。用in 语句来实现。
select * from 订单表 where 地区 in (select 地区 from 客户表 where 地区 = ‘华东地区’);