O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
hirist 
.com 
www.hirist.com 
SQL 
TOP 100 
INTERVIEW QUESTIONS & ANSWERS
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisDBMS? 
2 
QUESTION 
ADatabaseManagementSystem(D...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisRDBMS? 
3 
QUESTION 
RDBMSstandsforRelationalDa...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisSQL? 
4 
QUESTION 
SQLstandsforStructuredQueryL...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisaDatabase? 
5 
QUESTION 
Databaseisnothingbutan...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhataretablesandFields? 
6 
QUESTION 
Atableisasetofd...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisaprimarykey? 
7 
QUESTION 
Aprimarykeyisacombin...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisauniquekey? 
8 
QUESTION 
AUniquekeyconstraintu...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisaforeignkey? 
9 
QUESTION 
Aforeignkeyisonetabl...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatarethetypesofjoinandexplaineach? 
10 
QUESTION 
T...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Explainanouterjoin? 
11 
QUESTION 
Anouterjoininclude...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisnormalization? 
12 
QUESTION 
Normalizationisth...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisDenormalization? 
13 
QUESTION 
DeNormalization...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatareallthedifferentnormalizations? 
14 
QUESTION 
...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisanIndex?Whatareallthedifferenttypesofindexes? 
...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisarelationshipandwhatarethey? 
16 
QUESTION 
Dat...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisaquery? 
17 
QUESTION 
ADBqueryisacodewrittenin...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatissubquery?Whatarethetypesofsubquery? 
18 
QUESTI...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisatrigger? 
19 
QUESTION 
ADBtriggerisacodeorpro...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatarethetypesofTriggers? 
20 
QUESTION 
Therearefou...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisthedifferencebetweenDELETETRUNCATEandDROPcomman...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisdataIntegrity? 
22 
QUESTION 
DataIntegritydefi...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatiscollation? 
23 
QUESTION 
Collationisdefinedass...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
AdvantagesandDisadvantagesofStoredProcedure? 
24 
QUE...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisSQLInjection? 
25 
QUESTION 
SQLInjectionisoneo...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisthedifferencebetweenaHAVINGCLAUSEandaWHERECLAUS...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Howwouldapplydaterangefilter? 
27 
QUESTION 
a.Youcan...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisthedifferencebetweenJOINandUNION? 
28 
QUESTION...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisthedifferenceamongUNION,MINUSandINTERSECT? 
29 ...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisSelfJoinandwhyisitrequired? 
30 
QUESTION 
Self...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
HowcanwetransposeatableusingSQL(changingrowstocolumno...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatarethedifferencesamongROWNUM,RANKandDENSE_RANK? 
...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisadatabasetransaction? 
33 
QUESTION 
Databasetr...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatarepropertiesofatransaction? 
34 
QUESTION 
Prope...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisaDatabaseLock?Whatarethetypeoflocks? 
35 
QUEST...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisaCompositeKey? 
36 
QUESTION 
ACompositeprimary...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisaCompositePrimaryKey? 
37 
QUESTION 
AComposite...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
DefineSQLInsertStatement? 
38 
QUESTION 
SQLINSERTsta...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
DefineSQLUpdateStatement? 
39 
QUESTION 
SQLUpdateisu...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatarewildcardsusedindatabaseforPatternMatching? 
40...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisCrossJoin? 
41 
QUESTION 
CrossJoinwillreturnal...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisaview? 
42 
QUESTION 
Viewsarevirtualtables.Unl...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisamaterializedview? 
43 
QUESTION 
Materializedv...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whataretheadvantagesanddisadvantagesofviewsinadatabas...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhendoyouuseUPDATE_STATISTICScommand? 
45 
QUESTION 
...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisanIDENTITYcolumnininsertstatements? 
46 
QUESTI...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
HowwillIretrieveallrecordsofemployment1thoseshouldnot...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhichTCP/IPportdoesSQLServerrunon?Howcanitbechanged? ...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisSQLServerAgent? 
49 
QUESTION 
SQLServeragentpl...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhichcommandusingQueryAnalyzerwillgiveyoutheversionof...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
HowtocreaterecursivequeryinSQLServer? 
51 
QUESTION 
...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisaconstraint? 
52 
QUESTION 
Constraintcanbeused...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisAutoIncrement? 
53 
QUESTION 
Autoincrementkeyw...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisDatawarehouse? 
54 
QUESTION 
Datawarehouseisac...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisuserdefinedfunctions? 
55 
QUESTION 
Userdefine...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatarealltypesofuserdefinedfunctions? 
56 
QUESTION ...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatarealldifferenttypesofcollationsensitivity? 
57 
...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisOnlineTransactionProcessing(OLTP)? 
58 
QUESTIO...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisanALIAScommand? 
59 
QUESTION 
ALIASnamecanbegi...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatareaggregateandscalarfunctions? 
60 
QUESTION 
Ag...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Howcanyoucreateanemptytablefromanexistingtable? 
61 
...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Howtofetchcommonrecordsfromtwotables? 
62 
QUESTION 
...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Howtoselectuniquerecordsfromatable? 
63 
QUESTION 
Se...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatarethedifferentindexconfigurationsatablecanhave? ...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatarethepropertiesanddifferentTypesofSub-Queries? 
...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisSQLProfiler? 
66 
QUESTION 
SQLProfilerisagraph...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhataretheauthenticationmodesinSQLServer?Howcanitbech...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Canastoredprocedurecallitselforrecursivestoredprocedu...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisLogShipping? 
69 
QUESTION 
Logshippingisthepro...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Name3waystogetanaccuratecountofthenumberofrecordsinat...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatdoesitmeantohaveQUOTED_IDENTIFIERON?Whataretheimp...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisthedifferencebetweenaLocalandaGlobaltemporaryta...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
HowGlobaltemporarytablesarerepresentedanditsscope? 
7...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatistheSTUFFfunctionandhowdoesitdifferfromtheREPLAC...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisCHECKConstraint? 
75 
QUESTION 
ACHECKconstrain...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisthedifferencebetweenUNIONandUNIONALL? 
76 
QUES...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisNOTNULLConstraint? 
77 
QUESTION 
ANOTNULLconst...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Howtoget@@ERRORand@@ROWCOUNTatthesametime? 
78 
QUEST...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisaScheduledJobsorWhatisaScheduledTasks? 
79 
QUE...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisatablecalled,ifithasneitherClusternorNon-cluste...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
CanSQLServerslinkedtootherserverslikeOracle? 
81 
QUE...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisBCP?Whendoesitused? 
82 
QUESTION 
BulkCopyisat...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Howtoimplementone-to-one,one-to-manyandmany-to-manyre...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisanexecutionplan?Whenwouldyouuseit?Howwouldyouvi...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatarethetwoauthenticationmodesinSQLServer? 
85 
QUE...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisCOALESCEinSQLServer? 
86 
QUESTION 
COALESCEisu...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
HowexceptionscanbehandledinSQLServerProgramming? 
87 ...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisthepurposeofFLOORfunction? 
88 
QUESTION 
FLOOR...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Canwechecklocksindatabase?Ifso,howcanwedothislockchec...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatistheuseofSIGNfunction? 
90 
QUESTION 
SIGNfuncti...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
HowistheSUBSTRkeywordusedinSQL? 
91 
QUESTION 
SUBSTR...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisaNULLvalue?WhataretheprosandconsofusingNULLS? 
...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisasynonym?Howisitused? 
93 
QUESTION 
Asynonymis...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisaCartesianproduct? 
94 
QUESTION 
ACartesianpro...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisatuple? 
95 
QUESTION 
StaticSQLiscompiledandop...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Whatisreferentialintegrity? 
96 
QUESTION 
Referentia...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
What’sthemaximumsizeofarow? 
97 
QUESTION 
8060bytes....
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
HowtochangeDatabasenameinSQLserver? 
98 
QUESTION 
Us...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisaCursor? 
99 
QUESTION 
AdatabaseCursorisacontr...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatareMagicTablesinSQLServer? 
100 
QUESTION 
Insert...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
WhatisISNULL()operator? 
101 
QUESTION 
ISNULLfunctio...
For the hottest SQL jobs, please visit www.hirist.com 
hirist 
.com 
Resources 
102 
http://www.itechaleart.com/2013/05/to...
www.hirist.com 
SQL 
TOP 100 
INTERVIEW QUESTIONS & ANSWERS
Próximos SlideShares
Carregando em…5
×

Top 100 SQL Interview Questions and Answers

47.428 visualizações

Publicada em

What are the top 100 SQL Interview Questions and Answers in 2014? Based on the most popular SQL questions asked in interview, we've compiled a list of the 100 most popular SQL interview questions in 2014.

This pdf includes oracle sql interview questions and answers, sql query interview questions and answers, sql interview questions and answers for freshers etc and is perfect for those who're appearing for a linux interview in top IT companies like HCL, Infosys, TCS, Wipro, Tech Mahindra, Cognizant etc

This list includes SQL interview questions in the below categories:

top 100 sql interview questions and answers
top 100 java interview questions and answers
top 100 c interview questions and answers
top 50 sql interview questions and answers
top 100 interview questions and answers book
sql interview questions and answers pdf
oracle sql interview questions and answers
sql query interview questions and answers
sql interview questions and answers for freshers
SQL Queries Interview Questions and Answers
SQL Interview Questions and Answers
Top 80 + SQL Query Interview Questions and Answers
Top 20 SQL Interview Questions with Answers
Sql Server Interviews Questions and Answers
100 Mysql interview questions and answers
SQL Queries Interview Questions
SQL Query Interview Questions and Answers with Examples
Mysql interview questions and answers for freshers and experienced

Publicada em: Carreiras
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Very Nice, If you want more good Presentations Please visit www.ThesisScientist.com, Its a wonderful website for latest Presentations and Research
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • More than 5000 IT Certified ( SAP,Oracle,Mainframe,Microsoft and IBM Technologies etc...)Consultants registered. Register for IT courses at http://www.todaycourses.com Most of our companies will help you in processing H1B Visa, Work Permit and Job Placements
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Learn latest interview questions @ http://modernpathshala.com/Learn/SQL/Interview
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Search more than 5000 IT certified Trainers at http://www.todaycourses.com
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui

Top 100 SQL Interview Questions and Answers

  1. 1. hirist .com www.hirist.com SQL TOP 100 INTERVIEW QUESTIONS & ANSWERS
  2. 2. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisDBMS? 2 QUESTION ADatabaseManagementSystem(DBMS)isaprogramthatcontrolscreation,maintenanceanduseofadatabase. DBMScanbetermedasFileManagerthatmanagesdatainadatabaseratherthansavingitinfilesystems. ANSWER QUESTION 1
  3. 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. 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. 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. 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. 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. 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. 9. For the hottest SQL jobs, please visit www.hirist.com hirist .com Whatisaforeignkey? 9 QUESTION Aforeignkeyisonetablewhichcanberelatedtotheprimarykeyofanothertable.Relationshipneedstobecreatedbetweentwotablesbyreferencingforeignkeywiththeprimarykeyofanothertable. ANSWER QUESTION 8
  10. 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. 11. For the hottest SQL jobs, please visit www.hirist.com hirist .com Explainanouterjoin? 11 QUESTION Anouterjoinincludesrowsfromtableswhentherearenomatchingvaluesinthetables. ANSWER QUESTION 10
  12. 12. For the hottest SQL jobs, please visit www.hirist.com hirist .com Whatisnormalization? 12 QUESTION Normalizationistheprocessofminimizingredundancyanddependencybyorganizingfieldsandtableofadatabase.ThemainaimofNormalizationistoadd,deleteormodifyfieldthatcanbemadeinasingletable. ANSWER QUESTION 11
  13. 13. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisDenormalization? 13 QUESTION DeNormalizationisatechniqueusedtoaccessthedatafromhighertolowernormalformsofdatabase.Itisalsoprocessofintroducingredundancyintoatablebyincorporatingdatafromtherelatedtables. ANSWER QUESTION 12
  14. 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. 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. 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. 17. For the hottest SQL jobs, please visit www.hirist.com hirist .com Whatisaquery? 17 QUESTION ADBqueryisacodewritteninordertogettheinformationbackfromthedatabase.Querycanbedesignedinsuchawaythatitmatchedwithourexpectationoftheresultset.Simply,aquestiontotheDatabase. ANSWER QUESTION 16
  18. 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. 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. 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. 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. 22. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisdataIntegrity? 22 QUESTION DataIntegritydefinestheaccuracyandconsistencyofdatastoredinadatabase.Itcanalsodefineintegrityconstraintstoenforcebusinessrulesonthedatawhenitisenteredintotheapplicationordatabase. ANSWER QUESTION 21
  23. 23. For the hottest SQL jobs, please visit www.hirist.com hirist .com Whatiscollation? 23 QUESTION Collationisdefinedassetofrulesthatdeterminehowcharacterdatacanbesortedandcompared.ThiscanbeusedtocompareAand,otherlanguagecharactersandalsodependsonthewidthofthecharacters. ASCIIvaluecanbeusedtocomparethesecharacterdata. ANSWER QUESTION 22
  24. 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. 25. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisSQLInjection? 25 QUESTION SQLInjectionisoneofthetechniquesusesbyhackerstohackawebsitebyinjectingSQLcommandsindatafields. ANSWER QUESTION 24
  26. 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. 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. 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. 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. 30. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisSelfJoinandwhyisitrequired? 30 QUESTION SelfJoinistheactofjoiningonetablewithitself.SelfJoinisoftenveryusefultoconvertahierarchicalstructureintoaflatstructure ANSWER QUESTION 29
  31. 31. For the hottest SQL jobs, please visit www.hirist.com hirist .com HowcanwetransposeatableusingSQL(changingrowstocolumnorvice-versa)? 31 QUESTION TheusualwaytodoitinSQListouseCASEstatementorDECODEstatement. ANSWER QUESTION 30
  32. 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. 33. For the hottest SQL jobs, please visit www.hirist.com hirist .com Whatisadatabasetransaction? 33 QUESTION Databasetransactiontakedatabasefromoneconsistentstatetoanother.Attheendofthetransactionthesystemmustbeinthepriorstateiftransactionfailsorthestatusofthesystemshouldreflectthesuccessfulcompletionifthetransactiongoesthrough. ANSWER QUESTION 32
  34. 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. 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. 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. 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. 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. 39. For the hottest SQL jobs, please visit www.hirist.com hirist .com DefineSQLUpdateStatement? 39 QUESTION SQLUpdateisusedtoupdatedatainaroworsetofrowsspecifiedinthefiltercondition. ThebasicformatofanSQLUPDATEstatementis,UpdatecommandfollowedbytabletobeupdatedandSETcommandfollowedbycolumnnamesandtheirnewvaluesfollowedbyfilterconditionthatdetermineswhichrowsshouldbeupdated. ANSWER QUESTION 38
  40. 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. 41. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisCrossJoin? 41 QUESTION CrossJoinwillreturnallrecordswhereeachrowfromthefirsttableiscombinedwitheachrowfromthesecondtable. ANSWER QUESTION 40
  42. 42. For the hottest SQL jobs, please visit www.hirist.com hirist .com Whatisaview? 42 QUESTION Viewsarevirtualtables.Unliketablesthatcontaindata,viewssimplycontainqueriesthatdynamicallyretrievedatawhenused. ANSWER QUESTION 41
  43. 43. For the hottest SQL jobs, please visit www.hirist.com hirist .com Whatisamaterializedview? 43 QUESTION Materializedviewsisalsoaviewbutarediskbased.Materializedviewsgetupdatedonspecificduration,baseupontheintervalspecifiedinthequerydefinition.Wecanindexmaterializedview. ANSWER QUESTION 42
  44. 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. 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. 46. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisanIDENTITYcolumnininsertstatements? 46 QUESTION IDENTITYcolumnisusedintablecolumnstomakethatcolumnasAutoincrementalnumberorasurrogatekey. ANSWER QUESTION 45
  47. 47. For the hottest SQL jobs, please visit www.hirist.com hirist .com HowwillIretrieveallrecordsofemployment1thoseshouldnotbepresentnemployment2? 47 QUESTION (Select*fromemployment2)-(Select*fromemployment1). ANSWER QUESTION 46
  48. 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. 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. 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. 51. For the hottest SQL jobs, please visit www.hirist.com hirist .com HowtocreaterecursivequeryinSQLServer? 51 QUESTION RecursivequerycanbecreateinSQLusingstoredprocedurebutyoucanalsouseCTE(Commontableexpression).ItmightbealsoworthaskingaboutperformanceasCTEisnotalwaysveryfast. ANSWER QUESTION 51
  52. 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. 53. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisAutoIncrement? 53 QUESTION Autoincrementkeywordallowstheusertocreateauniquenumbertobegeneratedwhenanewrecordisinsertedintothetable.AUTOINCREMENTkeywordcanbeusedinOracleandIDENTITYkeywordcanbeusedinSQLSERVER. MostlythiskeywordcanbeusedwheneverPRIMARYKEYisused. ANSWER QUESTION 52
  54. 54. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisDatawarehouse? 54 QUESTION Datawarehouseisacentralrepositoryofdatafrommultiplesourcesofinformation.Thosedataareconsolidated, transformedandmadeavailablefortheminingandonlineprocessing.WarehousedatahaveasubsetofdatacalledDataMarts. ANSWER QUESTION 53
  55. 55. For the hottest SQL jobs, please visit www.hirist.com hirist .com Whatisuserdefinedfunctions? 55 QUESTION Userdefinedfunctionsarethefunctionswrittentousethatlogicwheneverrequired.Itisnotnecessarytowritethesamelogicseveraltimes.Instead,functioncanbecalledorexecutedwheneverneeded. ANSWER QUESTION 54
  56. 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. 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. 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. 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. 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. 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. 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. 63. For the hottest SQL jobs, please visit www.hirist.com hirist .com Howtoselectuniquerecordsfromatable? 63 QUESTION SelectuniquerecordsfromatablebyusingDISTINCTkeyword. SelectDISTINCTStudentID,StudentNamefromStudent. ANSWER QUESTION 62
  64. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 75. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisCHECKConstraint? 75 QUESTION ACHECKconstraintisusedtolimitthevaluesthatcanbeplacedinacolumn.Thecheckconstraintsareusedtoenforcedomainintegrity. ANSWER QUESTION 74
  76. 76. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisthedifferencebetweenUNIONandUNIONALL? 76 QUESTION UNIONstatementismainlyusedtocombinethetablesincludingtheduplicaterowsandUNIONALLcombinebutdoesnotlookforduplicaterows.Withthis,UNIONALLwillbeveryfasterthanUNIONstatements. ANSWER QUESTION 75
  77. 77. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisNOTNULLConstraint? 77 QUESTION ANOTNULLconstraintenforcesthatthecolumnwillnotacceptnullvalues.Thenotnullconstraintsareusedtoenforcedomainintegrity,asthecheckconstraints. ANSWER QUESTION 76
  78. 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. 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. 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. 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. 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. 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. 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. 85. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatarethetwoauthenticationmodesinSQLServer? 85 QUESTION Therearetwoauthenticationmodes– •WindowsMode •MixedMode ModescanbechangedbyselectingthetoolsmenuofSQLServerconfigurationpropertiesandchoosesecuritypage. ANSWER QUESTION 84
  86. 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. 87. For the hottest SQL jobs, please visit www.hirist.com hirist .com HowexceptionscanbehandledinSQLServerProgramming? 87 QUESTION ExceptionsarehandledusingTRY—-CATCHconstructsanditishandlesbywritingscriptsinsidetheTRYblockanderrorhandlingintheCATCHblock. ANSWER QUESTION 86
  88. 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. 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. 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. 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. 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. 93. For the hottest SQL jobs, please visit www.hirist.com hirist .com Whatisasynonym?Howisitused? 93 QUESTION Asynonymisusedtoreferenceatableorviewbyanothername.Theothernamecanthenbewrittenintheapplicationcodepointingtotesttablesinthedevelopmentstageandtoproductionentitieswhenthecodeismigrated.ThesynonymislinkedtotheAUTHIDthatcreatedit. ANSWER QUESTION 92
  94. 94. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisaCartesianproduct? 94 QUESTION ACartesianproductresultsfromafaultyquery.Itisarowintheresultsforeverycombinationinthejointables. ANSWER QUESTION 93
  95. 95. For the hottest SQL jobs, please visit www.hirist.com hirist .com Whatisatuple? 95 QUESTION StaticSQLiscompiledandoptimizedpriortoitsexecution;dynamiciscompiledandoptimizedduringexecution. ANSWER QUESTION 94
  96. 96. For the hottest SQL jobs, please visit www.hirist.com hirist .com Whatisreferentialintegrity? 96 QUESTION Referentialintegrityreferstotheconsistencythatmustbemaintainedbetweenprimaryandforeignkeys,i.e.everyforeignkeyvaluemusthaveacorrespondingprimarykeyvalue. ANSWER QUESTION 95
  97. 97. For the hottest SQL jobs, please visit www.hirist.com hirist .com What’sthemaximumsizeofarow? 97 QUESTION 8060bytes. ANSWER QUESTION 96
  98. 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. 99. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisaCursor? 99 QUESTION AdatabaseCursorisacontrolwhichenablestraversalovertherowsorrecordsinthetable.Thiscanbeviewedasapointertoonerowinasetofrows.Cursorisverymuchusefulfortraversingsuchasretrieval,additionandremovalofdatabaserecords. ANSWER QUESTION 98
  100. 100. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatareMagicTablesinSQLServer? 100 QUESTION InsertandDeletetablesarecreatedwhenthetriggerisfiredforanyDMLcommand.ThosetablesarecalledMagicTablesinSQLServer.Thesemagictablesareusedinsidethetriggersfordatatransaction. ANSWER QUESTION 99
  101. 101. For the hottest SQL jobs, please visit www.hirist.com hirist .com WhatisISNULL()operator? 101 QUESTION ISNULLfunctionisusedtocheckwhethervaluegivenisNULLornotNULLinsqlserver.ThisfunctionalsoprovidestoreplaceavaluewiththeNULL. ANSWER QUESTION 100
  102. 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
  103. 103. www.hirist.com SQL TOP 100 INTERVIEW QUESTIONS & ANSWERS

×