2018-11-27
閱讀量:
939
子查詢
子查詢:寫(xiě)在()中,把內(nèi)層查詢結(jié)果當(dāng)做外層查詢參照的數(shù)據(jù)表來(lái)用
例: 用in操作符與子查詢語(yǔ)句來(lái)查詢所有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操作符與子查詢語(yǔ)句來(lái)查詢所有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操作符與子查詢語(yǔ)句來(lái)查詢所有f_price大于20元的水果記錄
select * from fruits where f_price > all
(select f_price from fruits where f_price < 20);
例: 用exists操作符與子查詢語(yǔ)句來(lái)查詢是否存在f_price大于30元的水果記錄
select * from fruits where exists
(select * from fruits where f_price > 30);






評(píng)論(0)


暫無(wú)數(shù)據(jù)
CDA考試動(dòng)態(tài)
CDA報(bào)考指南
推薦帖子
0條評(píng)論
1條評(píng)論
0條評(píng)論
0條評(píng)論