📄 子查询.sql
字号:
use northwind
go
select * from orders
go
select T.orderid,T.customerid
from(select orderid,customerid
from orders) as T
go
select orderid,customerid from orders
go
select * from orders
go
select * from [order details]
where productid=23
go
select customerid from orders
where 20 >( select quantity from [order details]
where productid=23 and orders.orderid=[order details].orderid
)
go
select * from [order details]
go
select productid,quantity from [order details] as or1
where quantity = (select max(quantity) from [order details] as or2
where or1.productid=or2.productid
)
order by productid
go
/*
select productid,max(quantity)as quantity from [order details]
group by productid
order by productid
go
与上面代码等价。哈哈哈哈
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -