文章目录
-
-
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
60

select cust_id from Customers;
61

select distinct prod_id from OrderItems;
62

select * from Customers;
63

小小的脑袋大大的疑惑,按字母排?order by
select cust_name from Customers order by cust_name desc;
64

id正序,订单日期倒序
select cust_id,order_num from Orders order by cust_id,order_date desc;
65

select quantity,item_price from OrderItems order by quantity desc,item_price desc;
66

select vend_name from Vendors order by vend_name desc;
67

select prod_id,prod_name from Products where prod_price = 9.49;
68

select prod_id,prod_name from Products where prod_price >= 9;
69

两种都行
select prod_name,prod_price from Products where prod_price between 3 and 6;
select prod_name,prod_price from Products where prod_price >=3 and prod_price <=6;
70

select distinct order_num from OrderItems where quantity >=100;
71

select vend_name from Vendors where vend_country = 'USA' and vend_state = 'CA';
72

select order_num,prod_id,quantity from OrderItems where quantity>=100 and (prod_id = 'BR01' | prod_id = 'BR01'|prod_id = 'BR01');
select order_num,prod_id,quantity from OrderItems where quantity>=100 and prod_id in ( 'BR01' ,'BR02','BR03');
73

select prod_name,prod_price from Products where prod_price >=3 and prod_price <=6 order by prod_price;
74

SELECT vend_name
FROM Vendors
WHERE vend_country = 'USA' AND vend_state = 'CA' ORDER BY vend_name ;
75

select prod_name,prod_desc from Products where prod_desc like '%toy';
76

select prod_name,prod_desc
from Products
where prod_desc not like '%toy';
77

select prod_name,prod_desc
from Products prod_desc
where prod_desc like '%toy' and prod_desc like '%carrots%';
78

79

select
vend_id,
vend_name as vname,
vend_address as vaddress,
vend_city as vcity
from Vendors
order by vend_name ;
80

select prod_id,prod_price,prod_price * 0.9 as sale_price from Products;