资源描述:
《weekly12_solution》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、WEEKLY12SOLUTIONSQ1.Howmanyrecordsarereturnedfromthefollowingquery?SELECT*FROMTests,ProjectsWHERETests.ID=Projects.ID1.62.53.44.2TheSQLstatementjoinsthetablesTestsandProjectsonthecommoncolumnID.Sincethereare4commonID’s(1,2,3,4-seeIDcolumn)intestsandprojectsta
2、bles,thecorrectchoiceis3.Q2.Howmanyrecordsarereturnedfromthefollowingquery?SELECT*FROMTests,Projects1.252.53.64.30TheSQLstatementjoinsthetablesTestsandProjectssuchthateachrowofTeststablewillbejoinedwitheachrowofProjectstable.Sincethereare5rowseachinbothtestsa
3、ndprojectstables,thetotalnumberofrowsreturnedwillbe5x5=25i.e.choice1.Q3.Howmanyrowsdoesthebelowqueryreturn?SELECT*fromTable1,Table2WHERETable1.ld=Table2.ld1.12.33.44.9Thisquestionissimilartoquestion1.TheSQLstatementjoinsthetablesTest1andTest2onthecommoncolumn
4、Id.Sincethereisonly1commonId(2)inboththetables,thecorrectchoiceis1.Q4.SameasQ3.Q5.Canaddingan"IN"operatorintheWHEREclause:1.Onlydecrease#ofrecordsintheresultset2.Onlyincrease#ofrecordsintheresultset3.Bothincrease&decrease#ofrecordsintheresultset4.Cannotchange
5、#ofrecordsintheresultsetAnINkeywordisusedwhenyouwanttoselectsomerecordsthatmatchaspecificcriteria.Forexample:ifyouwanttoselectiphoneproductsfromtheproductstable,youcanuse:select*fromproductswhereprod_nameIN('iPhone4','iPhone4S')Now,asyoucansee,theINkeywordfil
6、terstheresults.Soitcanonlydecreasethenumberofrecordsintheresultset.Thecorrectchoiceis1.Q6.HowmanyrecordscanresultfromaJOINtwotables(possiblywithaWHEREclause):1.Thelesserofthetwotables2.Thegreaterofthetwotables3.Thesumofthetwotables4.Possiblymoreorlessthanthes
7、umofthetwotablesWhenyoujointwotables,youmaygetmoreorlessrowsthaneithertablehasdependingonthestatementandnatureofjoin.Thecorrectchoiceis4.Q7.Bookshopdatabase:(3tables)books,customers,ordersbookscustomersordersWhatistheoutputofthequery:SELECTTitleFROMbooksWHERE
8、(TitleLIKE"%SQL%"ORTitleLIKE"%VBA%")ANDNOT(PRICE>20)1.2.3.4.TheSQLquerywantsustoreturntitleofthosebooksthathaveeitherSQLorVBAanywhereinitstitlebutwherethepriceislessthan$20.The%wildcardss