More Related Content Similar to Top 100 SQL Interview Questions and Answers (20) Top 100 SQL Interview Questions and Answers2. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisDBMS?
2
QUESTION
ADatabaseManagementSystem(DBMS)isaprogramthatcontrolscreation,maintenanceanduseofadatabase. DBMScanbetermedasFileManagerthatmanagesdatainadatabaseratherthansavingitinfilesystems.
ANSWER
QUESTION 1 3. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisRDBMS?
3
QUESTION
RDBMSstandsforRelationalDatabaseManagementSystem.RDBMSstorethedataintothecollectionoftables, whichisrelatedbycommonfieldsbetweenthecolumnsofthetable.Italsoprovidesrelationaloperatorstomanipulatethedatastoredintothetables.
Example:SQLServer.
ANSWER
QUESTION 2 4. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisSQL?
4
QUESTION
SQLstandsforStructuredQueryLanguage,anditisusedtocommunicatewiththeDatabase.Thisisastandardlanguageusedtoperformtaskssuchasretrieval,updation,insertionanddeletionofdatafromadatabase.
StandardSQLCommandsareSelect.
ANSWER
QUESTION 3 5. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisaDatabase?
5
QUESTION
Databaseisnothingbutanorganizedformofdataforeasyaccess,storing,retrievalandmanagingofdata.Thisisalsoknownasstructuredformofdatawhichcanbeaccessedinmanyways.
Example:SchoolManagementDatabase,BankManagementDatabase.
ANSWER
QUESTION 4 6. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhataretablesandFields?
6
QUESTION
AtableisasetofdatathatareorganizedinamodelwithColumnsandRows.Columnscanbecategorizedasvertical,andRowsarehorizontal.Atablehasspecifiednumberofcolumncalledfieldsbutcanhaveanynumberofrowswhichiscalledrecord.
Example:.
Table:Employee.
Field:EmpID,EmpName,DateofBirth.
Data:201456,David,11/15/1960.
ANSWER
QUESTION 5 7. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisaprimarykey?
7
QUESTION
Aprimarykeyisacombinationoffieldswhichuniquelyspecifyarow.Thisisaspecialkindofuniquekey,andithasimplicitNOTNULLconstraint.Itmeans,PrimarykeyvaluescannotbeNULL.
ANSWER
QUESTION 6 8. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisauniquekey?
8
QUESTION
AUniquekeyconstraintuniquelyidentifiedeachrecordinthedatabase.Thisprovidesuniquenessforthecolumnorsetofcolumns.
APrimarykeyconstrainthasautomaticuniqueconstraintdefinedonit.Butnot,inthecaseofUniqueKey.
Therecanbemanyuniqueconstraintdefinedpertable,butonlyonePrimarykeyconstraintdefinedpertable.
ANSWER
QUESTION 7 9. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisaforeignkey?
9
QUESTION
Aforeignkeyisonetablewhichcanberelatedtotheprimarykeyofanothertable.Relationshipneedstobecreatedbetweentwotablesbyreferencingforeignkeywiththeprimarykeyofanothertable.
ANSWER
QUESTION 8 10. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatarethetypesofjoinandexplaineach?
10
QUESTION
Therearevarioustypesofjoinwhichcanbeusedtoretrievedataanditdependsontherelationshipbetweentables.
InnerJoin:Innerjoinreturnrowswhenthereisatleastonematchofrowsbetweenthetables.
RightJoin:RightjoinreturnrowswhicharecommonbetweenthetablesandallrowsofRighthandsidetable. Simply,itreturnsalltherowsfromtherighthandsidetableeventhoughtherearenomatchesinthelefthandsidetable.
LeftJoin:LeftjoinreturnrowswhicharecommonbetweenthetablesandallrowsofLefthandsidetable.Simply,itreturnsalltherowsfromLefthandsidetableeventhoughtherearenomatchesintheRighthandsidetable.
FullJoin:Fulljoinreturnrowswhentherearematchingrowsinanyoneofthetables.Thismeans,itreturnsalltherowsfromthelefthandsidetableandalltherowsfromtherighthandsidetable.
ANSWER
QUESTION 9 11. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Explainanouterjoin?
11
QUESTION
Anouterjoinincludesrowsfromtableswhentherearenomatchingvaluesinthetables.
ANSWER
QUESTION 10 12. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisnormalization?
12
QUESTION
Normalizationistheprocessofminimizingredundancyanddependencybyorganizingfieldsandtableofadatabase.ThemainaimofNormalizationistoadd,deleteormodifyfieldthatcanbemadeinasingletable.
ANSWER
QUESTION 11 13. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisDenormalization?
13
QUESTION
DeNormalizationisatechniqueusedtoaccessthedatafromhighertolowernormalformsofdatabase.Itisalsoprocessofintroducingredundancyintoatablebyincorporatingdatafromtherelatedtables.
ANSWER
QUESTION 12 14. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatareallthedifferentnormalizations?
14
QUESTION
Thenormalformscanbedividedinto4forms,andtheyareexplainedbelow-.
FirstNormalForm(1NF):Thisshouldremovealltheduplicatecolumnsfromthetable.Creationoftablesfortherelateddataandidentificationofuniquecolumns.
SecondNormalForm(2NF):Meetingallrequirementsofthefirstnormalform.PlacingthesubsetsofdatainseparatetablesandCreationofrelationshipsbetweenthetablesusingprimarykeys.
ThirdNormalForm(3NF):Thisshouldmeetallrequirementsof2NF.Removingthecolumnswhicharenotdependentonprimarykeyconstraints.
FourthNormalForm(4NF):Meetingalltherequirementsofthirdnormalformanditshouldnothavemulti- valueddependencies.
ANSWER
QUESTION 13 15. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisanIndex?Whatareallthedifferenttypesofindexes?
15
QUESTION
Anindexisperformancetuningmethodofallowingfasterretrievalofrecordsfromthetable.Anindexcreatesanentryforeachvalueanditwillbefastertoretrievedata.
Thisindexingdoesnotallowthefieldtohaveduplicatevaluesifthecolumnisuniqueindexed.Uniqueindexcanbeappliedautomaticallywhenprimarykeyisdefined.
ClusteredIndex:Thistypeofindexreordersthephysicalorderofthetableandsearchbasedonthekeyvalues. Eachtablecanhaveonlyoneclusteredindex.
NonClusteredIndex:NonClusteredIndexdoesnotalterthephysicalorderofthetableandmaintainslogicalorderofdata.Eachtablecanhave999nonclusteredindexes.
ANSWER
QUESTION 14 16. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisarelationshipandwhatarethey?
16
QUESTION
DatabaseRelationshipisdefinedastheconnectionbetweenthetablesinadatabase.Therearevariousdatabasingrelationships,andtheyareasfollows:. OnetoOneRelationship. OnetoManyRelationship. ManytoOneRelationship. Self-ReferencingRelationship.
ANSWER
QUESTION 15 17. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisaquery?
17
QUESTION
ADBqueryisacodewritteninordertogettheinformationbackfromthedatabase.Querycanbedesignedinsuchawaythatitmatchedwithourexpectationoftheresultset.Simply,aquestiontotheDatabase.
ANSWER
QUESTION 16 18. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatissubquery?Whatarethetypesofsubquery?
18
QUESTION
Asubqueryisaquerywithinanotherquery.Theouterqueryiscalledasmainquery,andinnerqueryiscalledsubquery.SubQueryisalwaysexecutedfirst,andtheresultofsubqueryispassedontothemainquery.
Therearetwotypesofsubquery–CorrelatedandNon-Correlated.
Acorrelatedsubquerycannotbeconsideredasindependentquery,butitcanreferthecolumninatablelistedintheFROMthelistofthemainquery.
ANon-Correlatedsubquerycanbeconsideredasindependentqueryandtheoutputofsubqueryaresubstitutedinthemainquery.
ANSWER
QUESTION 17 19. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisatrigger?
19
QUESTION
ADBtriggerisacodeorprogramsthatautomaticallyexecutewithresponsetosomeeventonatableorviewinadatabase.Mainly,triggerhelpstomaintaintheintegrityofthedatabase.
Example:Whenanewstudentisaddedtothestudentdatabase,newrecordsshouldbecreatedintherelatedtableslikeExam,ScoreandAttendancetables.
ANSWER
QUESTION 18 20. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatarethetypesofTriggers?
20
QUESTION
Therearefourtypesoftriggersandtheyare:
•Insert
•Delete
•Update
•Insteadof
ANSWER
QUESTION 19 21. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisthedifferencebetweenDELETETRUNCATEandDROPcommands?
21
QUESTION
DELETEcommandisusedtoremoverowsfromthetable,andWHEREclausecanbeusedforconditionalsetofparameters.CommitandRollbackcanbeperformedafterdeletestatement.
TRUNCATEremovesallrowsfromthetable.Truncateoperationcannotberolledback.
Dropcommandisusedtodropthetableorkeyslikeprimary,foreignfromatable.
ANSWER
QUESTION 20 22. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisdataIntegrity?
22
QUESTION
DataIntegritydefinestheaccuracyandconsistencyofdatastoredinadatabase.Itcanalsodefineintegrityconstraintstoenforcebusinessrulesonthedatawhenitisenteredintotheapplicationordatabase.
ANSWER
QUESTION 21 23. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatiscollation?
23
QUESTION
Collationisdefinedassetofrulesthatdeterminehowcharacterdatacanbesortedandcompared.ThiscanbeusedtocompareAand,otherlanguagecharactersandalsodependsonthewidthofthecharacters.
ASCIIvaluecanbeusedtocomparethesecharacterdata.
ANSWER
QUESTION 22 24. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
AdvantagesandDisadvantagesofStoredProcedure?
24
QUESTION
Storedprocedurecanbeusedasamodularprogramming–meanscreateonce,storeandcallforseveraltimeswheneverrequired.Thissupportsfasterexecutioninsteadofexecutingmultiplequeries.Thisreducesnetworktrafficandprovidesbettersecuritytothedata.
DisadvantageisthatitcanbeexecutedonlyintheDatabaseandutilizesmorememoryinthedatabaseserver.
ANSWER
QUESTION 23 25. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisSQLInjection?
25
QUESTION
SQLInjectionisoneofthetechniquesusesbyhackerstohackawebsitebyinjectingSQLcommandsindatafields.
ANSWER
QUESTION 24 26. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisthedifferencebetweenaHAVINGCLAUSEandaWHERECLAUSE?
26
QUESTION
Theyspecifyasearchconditionforagrouporanaggregate.ButthedifferenceisthatHAVINGcanbeusedonlywiththeSELECTstatement.HAVINGistypicallyusedinaGROUPBYclause.WhenGROUPBYisnotused, HAVINGbehaveslikeaWHEREclause.HavingClauseisbasicallyusedonlywiththeGROUPBYfunctioninaquerywhereasWHEREClauseisappliedtoeachrowbeforetheyarepartoftheGROUPBYfunctioninaquery.
ANSWER
QUESTION 25 27. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Howwouldapplydaterangefilter?
27
QUESTION
a.Youcanusesimplecondition>=and<=orsimilarorusebetween/andbutthetrickistoknowyourexactdatatype.
b.Sometimesdatefieldscontaintimeandthatiswherethequerycangowrongsoitisrecommendedtousesomedaterelatedfunctionstoremovethetimeissue.InSQLServercommonfunctiontodothatisdatedifffunction.
c.Youalsohavetobeawareofdifferenttimezonesandservertimezone.
d.Toincreasequeryperformanceyoumaystillwanttousebetweenhoweveryoushouldbeawareofproperformatyoushoulduseifnotitmightmisbehaveduringfiltering.
ANSWER
QUESTION 26 28. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisthedifferencebetweenJOINandUNION?
28
QUESTION
SQLJOINallowsusto―lookup‖recordsonothertablebasedonthegivenconditionsbetweentwotables.Forexample,ifwehavethedepartmentIDofeachemployee,thenwecanusethisdepartmentIDoftheemployeetabletojoinwiththedepartmentIDofdepartmenttabletolookupdepartmentnames.
UNIONoperationallowsustoadd2similardatasetstocreateresultingdatasetthatcontainsallthedatafromthesourcedatasets.Uniondoesnotrequireanyconditionforjoining.Forexample,ifyouhave2employeetableswithsamestructure,youcanUNIONthemtocreateoneresultsetthatwillcontainalltheemployeesfrombothofthetables.
SELECT*FROMEMP1
UNION
SELECT*FROMEMP2;
ANSWER
QUESTION 27 29. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisthedifferenceamongUNION,MINUSandINTERSECT?
29
QUESTION
UNIONcombinestheresultsfrom2tablesandeliminatesduplicaterecordsfromtheresultset.
MINUSoperatorwhenusedbetween2tables,givesusalltherowsfromthefirsttableexcepttherowswhicharepresentinthesecondtable.
INTERSECToperatorreturnsusonlythematchingorcommonrowsbetween2resultsets.
ANSWER
QUESTION 28 30. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisSelfJoinandwhyisitrequired?
30
QUESTION
SelfJoinistheactofjoiningonetablewithitself.SelfJoinisoftenveryusefultoconvertahierarchicalstructureintoaflatstructure
ANSWER
QUESTION 29 31. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
HowcanwetransposeatableusingSQL(changingrowstocolumnorvice-versa)?
31
QUESTION
TheusualwaytodoitinSQListouseCASEstatementorDECODEstatement.
ANSWER
QUESTION 30 32. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatarethedifferencesamongROWNUM,RANKandDENSE_RANK?
32
QUESTION
ROW_NUMBERassignscontiguous,uniquenumbersfrom1..Ntoaresultset.
RANKdoesnotassignuniquenumbers—nordoesitassigncontiguousnumbers.Iftworecordstieforsecondplace,norecordwillbeassignedthe3rdrankasnoonecameinthird,accordingtoRANK.
DENSE_RANK,likeRANK,doesnotassignuniquenumbers,butitdoesassigncontiguousnumbers.Eventhoughtworecordstiedforsecondplace,thereisathird-placerecord.
ANSWER
QUESTION 31 33. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisadatabasetransaction?
33
QUESTION
Databasetransactiontakedatabasefromoneconsistentstatetoanother.Attheendofthetransactionthesystemmustbeinthepriorstateiftransactionfailsorthestatusofthesystemshouldreflectthesuccessfulcompletionifthetransactiongoesthrough.
ANSWER
QUESTION 32 34. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatarepropertiesofatransaction?
34
QUESTION
PropertiesofthetransactioncanbesummarizedasACIDProperties.
1.Atomicity:Atransactionconsistsofmanysteps.Whenallthestepsinatransactiongetscompleted,itwillgetreflectedinDBorifanystepfails,allthetransactionsarerolledback.
2.Consistency:Thedatabasewillmovefromoneconsistentstatetoanother,ifthetransactionsucceedsandremainintheoriginalstate,ifthetransactionfails.
3.Isolation:Everytransactionshouldoperateasifitistheonlytransactioninthesystem
4.Durability:Onceatransactionhascompletedsuccessfully,theupdatedrows/recordsmustbeavailableforallothertransactionsonapermanentbasis
ANSWER
QUESTION 33 35. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisaDatabaseLock?Whatarethetypeoflocks?
35
QUESTION
Databaselocktellatransaction,ifthedataiteminquestionsiscurrentlybeingusedbyothertransactions.
1.SharedLock:Whenasharedlockisappliedondataitem,othertransactionscanonlyreadtheitem,butcan'twriteintoit.
2.ExclusiveLock:Whenaexclusivelockisappliedondataitem,othertransactionscan'treadorwriteintothedataitem.
ANSWER
QUESTION 34 36. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisaCompositeKey?
36
QUESTION
ACompositeprimarykeyisatypeofcandidatekey,whichrepresentsasetofcolumnswhosevaluesuniquelyidentifyeveryrowinatable.
Forexample-if"Employee_ID"and"EmployeeName"inatableiscombinedtouniquelyidentifiesarowitscalledaCompositeKey.
ANSWER
QUESTION 35 37. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisaCompositePrimaryKey?
37
QUESTION
ACompositeprimarykeyisasetofcolumnswhosevaluesuniquelyidentifyeveryrowinatable.Whatitmeansisthat,tablewhichcontainscompositeprimarykeywillbeindexedbasedoncolumnsspecifiedintheprimarykey. ThiskeywillbereferredinForeignKeytables.
Forexample-ifcombinedeffectofcolumns,"Employee_ID"and"EmployeeName"inatableisrequiredtouniquelyidentifiesarow,itscalledaCompositePrimaryKey.Inthiscase,boththecolumnswillberepresentedasprimarykey.
ANSWER
QUESTION 36 38. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
DefineSQLInsertStatement?
38
QUESTION
SQLINSERTstatementisusedtoaddrowstoatable.Forafullrowinsert,SQLQueryshouldstartwith―insertinto―statementfollowedbytablenameandvaluescommand,followedbythevaluesthatneedtobeinsertedintothetable.Insertcanbeusedinseveralways:
1.Toinsertasinglecompleterow
2.Toinsertasinglepartialrow
ANSWER
QUESTION 37 39. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
DefineSQLUpdateStatement?
39
QUESTION
SQLUpdateisusedtoupdatedatainaroworsetofrowsspecifiedinthefiltercondition.
ThebasicformatofanSQLUPDATEstatementis,UpdatecommandfollowedbytabletobeupdatedandSETcommandfollowedbycolumnnamesandtheirnewvaluesfollowedbyfilterconditionthatdetermineswhichrowsshouldbeupdated.
ANSWER
QUESTION 38 40. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatarewildcardsusedindatabaseforPatternMatching?
40
QUESTION
SQLLikeoperatorisuserforpatternmatching.SQL'Like'commandtakesmoretimetoprocess.Sobeforeusinglikeoperator,considersuggestionsgivenbelowonwhenandwheretousewildcardsearch.
1)Don'toverusewildcards.Ifanothersearchoperatorwilldo,useitinstead.
2)Whenyoudousewildcards,trynottousethematthebeginningofthesearchpattern,unlessabsolutelynecessary.Searchpatternsthatbeginwithwildcardsaretheslowesttoprocess.
3)Paycarefulattentiontotheplacementofthewildcardsymbols.Iftheyaremisplaced,youmightnotreturnthedatayouintended
ANSWER
QUESTION 39 41. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisCrossJoin?
41
QUESTION
CrossJoinwillreturnallrecordswhereeachrowfromthefirsttableiscombinedwitheachrowfromthesecondtable.
ANSWER
QUESTION 40 42. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisaview?
42
QUESTION
Viewsarevirtualtables.Unliketablesthatcontaindata,viewssimplycontainqueriesthatdynamicallyretrievedatawhenused.
ANSWER
QUESTION 41 43. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisamaterializedview?
43
QUESTION
Materializedviewsisalsoaviewbutarediskbased.Materializedviewsgetupdatedonspecificduration,baseupontheintervalspecifiedinthequerydefinition.Wecanindexmaterializedview.
ANSWER
QUESTION 42 44. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whataretheadvantagesanddisadvantagesofviewsinadatabase?
44
QUESTION
Advantages:
1.Viewsdoesn'tstoredatainaphysicallocation.
2.Viewcanbeusetohidesomeofthecolumnsfromthetable
3.ViewscanprovideAccessRestriction,sincedatainsertion,updateanddeletionisnotpossibleontheview.
Disadvantages:
1.Whenatableisdropped,associatedviewbecomeirrelevant.
2.Sinceviewarecreatedwhenaqueryrequestingdatafromviewistriggered,itsbitslow
3.Whenviewsarecreatedforlargetables,itoccupymorememory.
ANSWER
QUESTION 43 45. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhendoyouuseUPDATE_STATISTICScommand?
45
QUESTION
Thiscommandisusedwhenalargeprocessingofdatahasoccurred.Ifanylargeamountofdeletions,anymodifications,orBulkCopyintothetableshasoccurred,ithastoupdatetheindexestotakethesechangesintoaccount.UPDATE_STATISTICSupdatestheindexesonthesetablesaccordingly.
ANSWER
QUESTION 44 46. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisanIDENTITYcolumnininsertstatements?
46
QUESTION
IDENTITYcolumnisusedintablecolumnstomakethatcolumnasAutoincrementalnumberorasurrogatekey.
ANSWER
QUESTION 45 47. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
HowwillIretrieveallrecordsofemployment1thoseshouldnotbepresentnemployment2?
47
QUESTION
(Select*fromemployment2)-(Select*fromemployment1).
ANSWER
QUESTION 46 48. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhichTCP/IPportdoesSQLServerrunon?Howcanitbechanged?
48
QUESTION
SQLServerrunsonport1433.ItcanbechangedfromtheNetworkUtilityTCP/IPproperties.
ANSWER
QUESTION 47 49. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisSQLServerAgent?
49
QUESTION
SQLServeragentplaysanimportantroleintheday-to-daytasksofadatabaseadministrator(DBA).ItspurposeistoeasetheimplementationoftasksfortheDBA,withitsfull-functionschedulingengine,whichallowsyoutoscheduleyourownjobsandscripts.
ANSWER
QUESTION 48 50. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhichcommandusingQueryAnalyzerwillgiveyoutheversionofSQLserverandoperatingsystem?
50
QUESTION
SELECTSERVERPROPERTY('productversion'),SERVERPROPERTY('productlevel')andSERVERPROPERTY('edition')
ANSWER
QUESTION 49 51. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
HowtocreaterecursivequeryinSQLServer?
51
QUESTION
RecursivequerycanbecreateinSQLusingstoredprocedurebutyoucanalsouseCTE(Commontableexpression).ItmightbealsoworthaskingaboutperformanceasCTEisnotalwaysveryfast.
ANSWER
QUESTION 51 52. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisaconstraint?
52
QUESTION
Constraintcanbeusedtospecifythelimitonthedatatypeoftable.Constraintcanbespecifiedwhilecreatingoralteringthetablestatement.Sampleofconstraintare.
•NOTNULL.
•CHECK.
•DEFAULT.
•UNIQUE.
•PRIMARYKEY.
•FOREIGNKEY.
ANSWER
QUESTION 51 53. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisAutoIncrement?
53
QUESTION
Autoincrementkeywordallowstheusertocreateauniquenumbertobegeneratedwhenanewrecordisinsertedintothetable.AUTOINCREMENTkeywordcanbeusedinOracleandIDENTITYkeywordcanbeusedinSQLSERVER.
MostlythiskeywordcanbeusedwheneverPRIMARYKEYisused.
ANSWER
QUESTION 52 54. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisDatawarehouse?
54
QUESTION
Datawarehouseisacentralrepositoryofdatafrommultiplesourcesofinformation.Thosedataareconsolidated, transformedandmadeavailablefortheminingandonlineprocessing.WarehousedatahaveasubsetofdatacalledDataMarts.
ANSWER
QUESTION 53 55. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisuserdefinedfunctions?
55
QUESTION
Userdefinedfunctionsarethefunctionswrittentousethatlogicwheneverrequired.Itisnotnecessarytowritethesamelogicseveraltimes.Instead,functioncanbecalledorexecutedwheneverneeded.
ANSWER
QUESTION 54 56. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatarealltypesofuserdefinedfunctions?
56
QUESTION
Threetypesofuserdefinedfunctionsare.
a.ScalarFunctions.
b.InlineTablevaluedfunctions.
c.Multistatementvaluedfunctions.
ANSWER
QUESTION 55 57. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatarealldifferenttypesofcollationsensitivity?
57
QUESTION
Followingaredifferenttypesofcollationsensitivity-.
•CaseSensitivity–AandaandBandb.
•AccentSensitivity.
•KanaSensitivity–JapaneseKanacharacters.
•WidthSensitivity–Singlebytecharacteranddoublebytecharacter.
ANSWER
QUESTION 56 58. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisOnlineTransactionProcessing(OLTP)?
58
QUESTION
OnlineTransactionProcessingorOLTPmanagestransactionbasedapplicationswhichcanbeusedfordataentryandeasyretrievalprocessingofdata.Thisprocessingmakeslikeeasieronsimplicityandefficiency.Itisfaster, moreaccurateresultsandexpenseswithrespecttoOTLP.
Example–BankTransactionsonadailybasis.
ANSWER
QUESTION 57 59. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisanALIAScommand?
59
QUESTION
ALIASnamecanbegiventoatableorcolumn.ThisaliasnamecanbereferredinWHEREclausetoidentifythetableorcolumn.
Example-.
Selectst.StudentID,Ex.Resultfromstudentst,ExamasExwherest.studentID=Ex.StudentID
Here,streferstoaliasnameforstudenttableandExreferstoaliasnameforexamtable.
ANSWER
QUESTION 58 60. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatareaggregateandscalarfunctions?
60
QUESTION
Aggregatefunctionsareusedtoevaluatemathematicalcalculationandreturnsinglevalues.Thiscanbecalculatedfromthecolumnsinatable.Scalarfunctionsreturnasinglevaluebasedontheinputvalue.
Example-.
Aggregate–max(),count–Calculatedwithrespecttonumeric.
Scalar–UCASE(),NOW()–Calculatedwithrespecttostrings.
ANSWER
QUESTION 59 61. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Howcanyoucreateanemptytablefromanexistingtable?
61
QUESTION
Select*intostudentcopyfromstudentwhere1=2
Here,wearecopyingstudenttabletoanothertablewiththesamestructurewithnorowscopied.
ANSWER
QUESTION 60 62. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Howtofetchcommonrecordsfromtwotables?
62
QUESTION
Commonrecordsresultsetcanbeachievedby-.
SelectstudentIDfromstudent.<strong>INTERSECT</strong>SelectStudentIDfromExam
ANSWER
QUESTION 61 63. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Howtoselectuniquerecordsfromatable?
63
QUESTION
SelectuniquerecordsfromatablebyusingDISTINCTkeyword.
SelectDISTINCTStudentID,StudentNamefromStudent.
ANSWER
QUESTION 62 64. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatarethedifferentindexconfigurationsatablecanhave?
64
QUESTION
Atablecanhaveoneofthefollowingindexconfigurations:
1.Noindexes
2.Aclusteredindex
3.Aclusteredindexandmanynonclusteredindexes
4.Anonclusteredindex
5.Manynonclusteredindexes
ANSWER
QUESTION 63 65. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatarethepropertiesanddifferentTypesofSub-Queries?
65
QUESTION
PropertiesofSub-Query
a.Asub-querymustbeenclosedintheparenthesis.
b.Asub-querymustbeputintherighthandofthecomparisonoperator,and
c.Asub-querycannotcontainanORDER-BYclause.
d.Aquerycancontainmorethanonesub-query.
TypesofSub-Query
e.Single-rowsub-query,wherethesub-queryreturnsonlyonerow.
f.Multiple-rowsub-query,wherethesub-queryreturnsmultiplerows,.and
g.Multiplecolumnsub-query,wherethesub-queryreturnsmultiplecolumns
ANSWER
QUESTION 64 66. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisSQLProfiler?
66
QUESTION
SQLProfilerisagraphicaltoolthatallowssystemadministratorstomonitoreventsinaninstanceofMicrosoftSQLServer.YoucancaptureandsavedataabouteacheventtoafileorSQLServertabletoanalyzelater.Forexample,youcanmonitoraproductionenvironmenttoseewhichstoredproceduresarehamperingperformancesbyexecutingtooslowly.
UseSQLProfilertomonitoronlytheeventsinwhichyouareinterested.Iftracesarebecomingtoolarge,youcanfilterthembasedontheinformationyouwant,sothatonlyasubsetoftheeventdataiscollected.Monitoringtoomanyeventsaddsoverheadtotheserverandthemonitoringprocessandcancausethetracefileortracetabletogrowverylarge,especiallywhenthemonitoringprocesstakesplaceoveralongperiodoftime.
ANSWER
QUESTION 65 67. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhataretheauthenticationmodesinSQLServer?Howcanitbechanged?
67
QUESTION
WindowsmodeandMixedMode-SQLandWindows.TochangeauthenticationmodeinSQLServerclickStart, Programs,MicrosoftSQLServerandclickSQLEnterpriseManagertorunSQLEnterpriseManagerfromtheMicrosoftSQLServerprogramgroup.SelecttheserverthenfromtheToolsmenuselectSQLServerConfigurationProperties,andchoosetheSecuritypage.
ANSWER
QUESTION 66 68. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Canastoredprocedurecallitselforrecursivestoredprocedure?HowmuchlevelSPnestingispossible?
68
QUESTION
Yes.BecauseTransact-SQLsupportsrecursion,youcanwritestoredproceduresthatcallthemselves.Recursioncanbedefinedasamethodofproblemsolvingwhereinthesolutionisarrivedatbyrepetitivelyapplyingittosubsetsoftheproblem.Acommonapplicationofrecursivelogicistoperformnumericcomputationsthatlendthemselvestorepetitiveevaluationbythesameprocessingsteps.StoredproceduresarenestedwhenonestoredprocedurecallsanotherorexecutesmanagedcodebyreferencingaCLRroutine,type,oraggregate.Youcanneststoredproceduresandmanagedcodereferencesupto32levels.
ANSWER
QUESTION 67 69. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisLogShipping?
69
QUESTION
LogshippingistheprocessofautomatingthebackupofdatabaseandtransactionlogfilesonaproductionSQLserver,andthenrestoringthemontoastandbyserver.EnterpriseEditionsonlysupportslogshipping.Inlogshippingthetransactionallogfilefromoneserverisautomaticallyupdatedintothebackupdatabaseontheotherserver.Ifoneserverfails,theotherserverwillhavethesamedbandcanbeusedthisastheDisasterRecoveryplan.Thekeyfeatureoflogshippingisthatitwillautomaticallybackuptransactionlogsthroughoutthedayandautomaticallyrestorethemonthestandbyserveratdefinedinterval.
ANSWER
QUESTION 68 70. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Name3waystogetanaccuratecountofthenumberofrecordsinatable?
70
QUESTION
SELECT*FROMtable1
SELECTCOUNT(*)FROMtable1
SELECTrowsFROMsysindexesWHEREid=OBJECT_ID(table1)ANDindid<2
ANSWER
QUESTION 69 71. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatdoesitmeantohaveQUOTED_IDENTIFIERON?WhataretheimplicationsofhavingitOFF?
71
QUESTION
WhenSETQUOTED_IDENTIFIERisON,identifierscanbedelimitedbydoublequotationmarks,andliteralsmustbedelimitedbysinglequotationmarks.WhenSETQUOTED_IDENTIFIERisOFF,identifierscannotbequotedandmustfollowallTransact-SQLrulesforidentifiers.
ANSWER
QUESTION 70 72. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisthedifferencebetweenaLocalandaGlobaltemporarytable?
72
QUESTION
1.Alocaltemporarytableexistsonlyforthedurationofaconnectionor,ifdefinedinsideacompoundstatement,forthedurationofthecompoundstatement.
2.Aglobaltemporarytableremainsinthedatabasepermanently,buttherowsexistonlywithinagivenconnection. Whenconnectionisclosed,thedataintheglobaltemporarytabledisappears.However,thetabledefinitionremainswiththedatabaseforaccesswhendatabaseisopenednexttime.
ANSWER
QUESTION 71 73. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
HowGlobaltemporarytablesarerepresentedanditsscope?
73
QUESTION
Globaltemporarytablesarerepresentedwith##beforethetablename.Scopewillbetheoutsidethesessionwhereaslocaltemporarytablesareinsidethesession.SessionIDcanbefoundusing@@SPID.
ANSWER
QUESTION 72 74. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatistheSTUFFfunctionandhowdoesitdifferfromtheREPLACEfunction?
74
QUESTION
STUFFfunctionisusedtooverwriteexistingcharacters.Usingthissyntax,STUFF(string_expression,start,length, replacement_characters),string_expressionisthestringthatwillhavecharacterssubstituted,startisthestartingposition,lengthisthenumberofcharactersinthestringthataresubstituted,andreplacement_charactersarethenewcharactersinterjectedintothestring.REPLACEfunctiontoreplaceexistingcharactersofalloccurrences. UsingthesyntaxREPLACE(string_expression,search_string,replacement_string),whereeveryincidenceofsearch_stringfoundinthestring_expressionwillbereplacedwithreplacement_string.
ANSWER
QUESTION 73 75. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisCHECKConstraint?
75
QUESTION
ACHECKconstraintisusedtolimitthevaluesthatcanbeplacedinacolumn.Thecheckconstraintsareusedtoenforcedomainintegrity.
ANSWER
QUESTION 74 76. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisthedifferencebetweenUNIONandUNIONALL?
76
QUESTION
UNIONstatementismainlyusedtocombinethetablesincludingtheduplicaterowsandUNIONALLcombinebutdoesnotlookforduplicaterows.Withthis,UNIONALLwillbeveryfasterthanUNIONstatements.
ANSWER
QUESTION 75 77. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisNOTNULLConstraint?
77
QUESTION
ANOTNULLconstraintenforcesthatthecolumnwillnotacceptnullvalues.Thenotnullconstraintsareusedtoenforcedomainintegrity,asthecheckconstraints.
ANSWER
QUESTION 76 78. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Howtoget@@ERRORand@@ROWCOUNTatthesametime?
78
QUESTION
If@@RowcountischeckedafterErrorcheckingstatementthenitwillhave0asthevalueof@@Recordcountasitwouldhavebeenreset.Andif@@Recordcountischeckedbeforetheerror-checkingstatementthen@@Errorwouldgetreset.Toget@@errorand@@rowcountatthesametimedobothinsamestatementandstoretheminlocalvariable.
SELECT@RC=@@ROWCOUNT,@ER=@@ERROR
ANSWER
QUESTION 77 79. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisaScheduledJobsorWhatisaScheduledTasks?
79
QUESTION
Scheduledtasksletuserautomateprocessesthatrunonregularorpredictablecycles.Usercanscheduleadministrativetasks,suchascubeprocessing,torunduringtimesofslowbusinessactivity.UsercanalsodeterminetheorderinwhichtasksrunbycreatingjobstepswithinaSQLServerAgentjob.E.g.backupdatabase,UpdateStatsofTables.Jobstepsgiveusercontroloverflowofexecution.Ifonejobfails,usercanconfigureSQLServerAgenttocontinuetoruntheremainingtasksortostopexecution.
ANSWER
QUESTION 78 80. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisatablecalled,ifithasneitherClusternorNon-clusterIndex?Whatisitusedfor?
80
QUESTION
UnindexedtableorHeap.MicrosoftPressBooksandBookonLine(BOL)refersitasHeap.Aheapisatablethatdoesnothaveaclusteredindexand,therefore,thepagesarenotlinkedbypointers.TheIAMpagesaretheonlystructuresthatlinkthepagesinatabletogether.Unindexedtablesaregoodforfaststoringofdata.Manytimesitisbettertodropallindexesfromtableandthendobulkofinsertsandtorestorethoseindexesafterthat.
ANSWER
QUESTION 79 81. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
CanSQLServerslinkedtootherserverslikeOracle?
81
QUESTION
SQLServercanbelinkedtoanyserverprovidedithasOLE-DBproviderfromMicrosofttoallowalink.E.g.OraclehasanOLE-DBproviderfororaclethatMicrosoftprovidestoadditaslinkedservertoSQLServergroup.
ANSWER
QUESTION 80 82. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisBCP?Whendoesitused?
82
QUESTION
BulkCopyisatoolusedtocopyhugeamountofdatafromtablesandviews.BCPdoesnotcopythestructuressameassourcetodestination.BULKINSERTcommandhelpstoimportadatafileintoadatabasetableorviewinauser-specifiedformat.
ANSWER
QUESTION 81 83. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Howtoimplementone-to-one,one-to-manyandmany-to-manyrelationshipswhiledesigningtables?
83
QUESTION
One-to-Onerelationshipcanbeimplementedasasingletableandrarelyastwotableswithprimaryandforeignkeyrelationships.One-to-Manyrelationshipsareimplementedbysplittingthedataintotwotableswithprimarykeyandforeignkeyrelationships.Many-to-Manyrelationshipsareimplementedusingajunctiontablewiththekeysfromboththetablesformingthecompositeprimarykeyofthejunctiontable.
ANSWER
QUESTION 82 84. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisanexecutionplan?Whenwouldyouuseit?Howwouldyouviewtheexecutionplan?
84
QUESTION
AnexecutionplanisbasicallyaroadmapthatgraphicallyortextuallyshowsthedataretrievalmethodschosenbytheSQLServerqueryoptimizerforastoredprocedureorad-hocqueryandisaveryusefultoolforadevelopertounderstandtheperformancecharacteristicsofaqueryorstoredproceduresincetheplanistheonethatSQLServerwillplaceinitscacheandusetoexecutethestoredprocedureorquery.FromwithinQueryAnalyzerisanoptioncalled"ShowExecutionPlan"(locatedontheQuerydrop-downmenu).Ifthisoptionisturnedonitwilldisplayqueryexecutionplaninseparatewindowwhenqueryisranagain.
ANSWER
QUESTION 83 85. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatarethetwoauthenticationmodesinSQLServer?
85
QUESTION
Therearetwoauthenticationmodes–
•WindowsMode
•MixedMode
ModescanbechangedbyselectingthetoolsmenuofSQLServerconfigurationpropertiesandchoosesecuritypage.
ANSWER
QUESTION 84 86. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisCOALESCEinSQLServer?
86
QUESTION
COALESCEisusedtoreturnfirstnon-nullexpressionwithinthearguments.Thisfunctionisusedtoreturnanon- nullfrommorethanonecolumninthearguments.
Example–
SelectCOALESCE(empno,empname,salary)fromemployee;
ANSWER
QUESTION 85 87. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
HowexceptionscanbehandledinSQLServerProgramming?
87
QUESTION
ExceptionsarehandledusingTRY—-CATCHconstructsanditishandlesbywritingscriptsinsidetheTRYblockanderrorhandlingintheCATCHblock.
ANSWER
QUESTION 86 88. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisthepurposeofFLOORfunction?
88
QUESTION
FLOORfunctionisusedtoroundupanon-integervaluetothepreviousleastinteger.ExampleisgivenFLOOR(6.7)
Returns6.
ANSWER
QUESTION 87 89. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Canwechecklocksindatabase?Ifso,howcanwedothislockcheck?
89
QUESTION
Yes,wecanchecklocksinthedatabase.Itcanbeachievedbyusingin-builtstoredprocedurecalledsp_lock.
ANSWER
QUESTION 88 90. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatistheuseofSIGNfunction?
90
QUESTION
SIGNfunctionisusedtodeterminewhetherthenumberspecifiedisPositive,NegativeandZero.Thiswillreturn+1,-1or0.
Example:SIGN(-35)returns-1
ANSWER
QUESTION 89 91. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
HowistheSUBSTRkeywordusedinSQL?
91
QUESTION
SUBSTRisusedforstringmanipulationwithcolumnname,firstpositionandstringlengthusedasarguments.E.g.
SUBSTR(NAME,13)referstothefirstthreecharactersinthecolumnNAME.
ANSWER
QUESTION 90 92. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisaNULLvalue?WhataretheprosandconsofusingNULLS?
92
QUESTION
ANULLvaluetakesuponebyteofstorageandindicatesthatavalueisnotpresentasopposedtoaspaceorzerovalue.It'stheDB2equivalentofTBDonanorganizationalchartandoftencorrectlyportraysabusinesssituation. Unfortunately,itrequiresextracodingforanapplicationprogramtohandlethissituation.
ANSWER
QUESTION 91 93. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisasynonym?Howisitused?
93
QUESTION
Asynonymisusedtoreferenceatableorviewbyanothername.Theothernamecanthenbewrittenintheapplicationcodepointingtotesttablesinthedevelopmentstageandtoproductionentitieswhenthecodeismigrated.ThesynonymislinkedtotheAUTHIDthatcreatedit.
ANSWER
QUESTION 92 94. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisaCartesianproduct?
94
QUESTION
ACartesianproductresultsfromafaultyquery.Itisarowintheresultsforeverycombinationinthejointables.
ANSWER
QUESTION 93 95. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisatuple?
95
QUESTION
StaticSQLiscompiledandoptimizedpriortoitsexecution;dynamiciscompiledandoptimizedduringexecution.
ANSWER
QUESTION 94 96. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Whatisreferentialintegrity?
96
QUESTION
Referentialintegrityreferstotheconsistencythatmustbemaintainedbetweenprimaryandforeignkeys,i.e.everyforeignkeyvaluemusthaveacorrespondingprimarykeyvalue.
ANSWER
QUESTION 95 97. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
What’sthemaximumsizeofarow?
97
QUESTION
8060bytes.
ANSWER
QUESTION 96 98. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
HowtochangeDatabasenameinSQLserver?
98
QUESTION
Usethefollowingcode:
SupportedinSQLserver2000and2005
Execsp_renamedb―test‖,―test1‖
SupportedinSQLServer2005andlaterversion
ALTERDatabase―test1‖ModifyName=―test‖
ANSWER
QUESTION 97 99. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisaCursor?
99
QUESTION
AdatabaseCursorisacontrolwhichenablestraversalovertherowsorrecordsinthetable.Thiscanbeviewedasapointertoonerowinasetofrows.Cursorisverymuchusefulfortraversingsuchasretrieval,additionandremovalofdatabaserecords.
ANSWER
QUESTION 98 100. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatareMagicTablesinSQLServer?
100
QUESTION
InsertandDeletetablesarecreatedwhenthetriggerisfiredforanyDMLcommand.ThosetablesarecalledMagicTablesinSQLServer.Thesemagictablesareusedinsidethetriggersfordatatransaction.
ANSWER
QUESTION 99 101. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
WhatisISNULL()operator?
101
QUESTION
ISNULLfunctionisusedtocheckwhethervaluegivenisNULLornotNULLinsqlserver.ThisfunctionalsoprovidestoreplaceavaluewiththeNULL.
ANSWER
QUESTION 100 102. For the hottest SQL jobs, please visit www.hirist.com
hirist
.com
Resources
102
http://www.itechaleart.com/2013/05/top-50-sql-question-answers_11.html
https://www.katieandemil.com/sql-interview-questions-and- answers?tab=article#Question 4
http://www.dwbiconcepts.com/tutorial/24-interview-questions/190-top-20-sql- interview-questions-with-answers.html
http://a4academics.com/interview-questions/53-database-and-sql/411-sql- interview-questions-and-answers-database
http://narendra86.blogspot.com/2013/10/top-80-sql-query-interview- questions.html
http://crackaninterview.com/sql-queries-interview-questions-answers/
http://career.guru99.com/top-50-sql-question-answers/
http://www.indiabix.com/technical/sql-server-common-questions/
http://career.guru99.com/top-50-sql-server-questions-answers/
http://www.ittestpapers.com/sql-interview-questions(25-50).html
http://www.dotnetfunda.com/interviews/cat/8/sql-server
http://www.careerride.com/SQLServer-Interview-Questions.aspx