【MySQL作业】SELECT 数据查询——美和易思MySQL运算符应用习题

点击打开所使用到的数据库>>>


1、查询指定姓名的客户(如“张晓静”)的地址和电话号码。

select address 地址, phone 电话号码 from customer where cName=‘张晓静’


2、查询单价高于某个值(如“200”)的生活电器类商品信息。

select goodsName 商品名 , unitPrice 单价 from goods where category=' 生活电器 ' and unitPrice>200


3、查询某些客户(如“张晓静”和“王勇强”)所有的订购日期信息。

select customerID , ordersDate from orders where customerID=3 or customerID=5


4、显示书籍类商品的所有订购明细。

select goodsID from goods where category=' 书籍 ';
select * from ordersDetail where goodsID=“上一步骤获取的商品编号”;

5、显示客户“张晓静”所有的订购明细。

select customerID from customer where category=' 张晓静 ';
select ordersID from orders where customerID=“上一步骤获取的客户编号”;
select * from ordersDetail where ordersID=“上一步骤获取的订单编号”;

>>知识点【第4章 SELECT 数据查询】
 

发布了116 篇原创文章 · 获赞 185 · 访问量 22万+

猜你喜欢

转载自blog.csdn.net/weixin_44893902/article/details/105741659