子查詢(xún):寫(xiě)在()中,把內(nèi)層查詢(xún)結(jié)果當(dāng)做外層查詢(xún)參照的數(shù)據(jù)表來(lái)用
例: 用in操作符與子查詢(xún)語(yǔ)句來(lái)查詢(xún)所有f_id對(duì)應(yīng)的f_price在10元到20元之間的水果記錄
select * from fruits where f_id in
(select f_id from fruits where f_price between 10 and 20);
例: 用any操作符與子查詢(xún)語(yǔ)句來(lái)查詢(xún)所有f_id對(duì)應(yīng)的f_price在10元到20元之間的水果記錄
select * from fruits where f_id = any
(select f_id from fruits where f_price between 10 and 20);
例: 用all操作符與子查詢(xún)語(yǔ)句來(lái)查詢(xún)所有f_price大于20元的水果記錄
select * from fruits where f_price > all
(select f_price from fruits where f_price < 20);
例: 用exists操作符與子查詢(xún)語(yǔ)句來(lái)查詢(xún)是否存在f_price大于30元的水果記錄
select * from fruits where exists
(select * from fruits where f_price > 30);








暫無(wú)數(shù)據(jù)