??SQL??????й???
???????????? ???????[ 2015/8/31 13:32:05 ] ?????????????
????д?????????????????SQL???????????????????????????????????????дSQL???????????????????б????????sql??????????????????????д???????????????????????????дд????Щ?????SQL SERVER2008??????????????
?????????????????SQL???
????1 select
????2 top 10 *
????3 from Student
????4 where age>20
????????SQL????????????????????????
??????1?????Student???????age>20?????????????Щ?????????????10???????
??????2?????Student????????10?????????????Щ?????????age>20???????
????????????????????????????????????????????????1?????????????????????????????????????????????????????????Щ??SQL?????????????SQL????????????????????????????????????SQL??????д???????SQL????б????????SQL???????????????
????????????????????????SQL???
????select
????distinct
????top 1
????Table1.id??COUNT(Table1.name) as nameCount
????from Table1
????inner join Table2
????on Table1.id=Table2.id
????where Table1.id<4
????group by Table1.id
????having Table1.id<3
????order by Table1.id desc
????????Table1??Table2??????????????????????????????????????ū?Щ?????????????????????????????????????????????????????SQL??????????Table1??Table2???£?
????Table1????????????????Table2
??????????????????SQL???????????????н???
??????8??????select
??????9??????distinct
??????11??????top 1 ??6???? Table1.id??COUNT(Table1.name) as nameCount
??????1??????from Table1
??????3??????inner join Table2
??????2??????on Table1.id=Table2.id
??????4??????where Table1.id<4
??????5??????group by Table1.id
??????7??????having Table1.id<3
??????10??????order by Table1.id desc
?????????????????е????
??????1??from????Table1??Table2??е???????????????????е??????????5*5=25?У??????????VT1
??????2??on?????VT1?е???ЩTable1.id=Table2.id???????У??????????VT2??
??????3??inner join?????????????????????VT2???????outer join????left join??right join??full join??????????????????????????VT1???????????????VT2??????VT3.
??????4??where?????VT3??Table1.id<4???????????VT4.
??????5??group by??????Table1.id???з??顣
??????6??COUNT????о?????????????Table1.id??????????????????????VT5
??????7??having?????VT5??Table1.id<3?????н???????????VT6
??????8??select?????VT6????????У????????VT7
??????9??distinct????VT7??????????????????VT8
??????10??order by????VT8????????Table1.id???????????????????????μ??VT9???????????α?VC9??
??????11??top?????α?VC9??????????????????????????1?У??????????VT10.
????????????????????SQL??佫VT10??????????á?
?????????????дSQL??????????????????????дSQL????????SQL?????????????????????????????????????
??????????????????????????????????????????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11