mysql作业(牛客60-80)

文章目录

      • 60
      • 61
      • 62
      • 63
      • 64
      • 65
      • 66
      • 67
      • 68
      • 69
      • 70
      • 71
      • 72
      • 73
      • 74
      • 75
      • 76
      • 77
      • 78
      • 79
      • 80

60

mysql作业(牛客60-80)_第1张图片

select cust_id from Customers;

61

mysql作业(牛客60-80)_第2张图片

select distinct prod_id from OrderItems;

62

mysql作业(牛客60-80)_第3张图片

select * from Customers;

63

mysql作业(牛客60-80)_第4张图片
小小的脑袋大大的疑惑,按字母排?order by

select cust_name from Customers order by cust_name desc;

64

mysql作业(牛客60-80)_第5张图片
id正序,订单日期倒序

select cust_id,order_num from Orders order by cust_id,order_date desc;

65

mysql作业(牛客60-80)_第6张图片

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

66

mysql作业(牛客60-80)_第7张图片

select vend_name from Vendors order by vend_name desc;

67

mysql作业(牛客60-80)_第8张图片

select prod_id,prod_name from Products where prod_price = 9.49;

68

mysql作业(牛客60-80)_第9张图片

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

69

mysql作业(牛客60-80)_第10张图片
两种都行

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

mysql作业(牛客60-80)_第11张图片

select distinct order_num from OrderItems where quantity >=100;

71

mysql作业(牛客60-80)_第12张图片

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

72

mysql作业(牛客60-80)_第13张图片

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

mysql作业(牛客60-80)_第14张图片

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

74

mysql作业(牛客60-80)_第15张图片

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

75

mysql作业(牛客60-80)_第16张图片

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

76

mysql作业(牛客60-80)_第17张图片

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

77

mysql作业(牛客60-80)_第18张图片

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

78

mysql作业(牛客60-80)_第19张图片


79

mysql作业(牛客60-80)_第20张图片

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

80

mysql作业(牛客60-80)_第21张图片

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

你可能感兴趣的:(MySQL,mysql,数据库)