SQL,自認爲sql還不錯,刷一刷打擊打擊本身,595. Big Countries

這道題,真是沒有說的,很正常的一句sqlsql

select name,population,area from World where population > 25000000 or area > 3000000索引

可是我查看了別人提交的,population與area是兩個條件,分別寫兩個子查詢,而後使用union並集,這樣查詢速度更快,使用or會先使用第一個索引進行篩選,而後在使用第二個進行篩選。使用union兩個子查詢能夠一塊兒查詢,因此效率快,LeetCode那麼解釋的,哈哈,我也不知道io

select name,population,area from World where population > 25000000效率

unionselect

select name,population,area from World where area > 3000000nio