3/8/2016 SQLInterviewQuestionsjavatpoint
ContentMenu
SQLInterviewQuestions
Thereisgivensqlinterviewquestionsandanswersthathas
[Link]/SQLinterviewquestions,
visitournextpage.
1)WhatisSQL?
[Link]
languageusedfordatabasecreation,deletion,fetchingrowsand
[Link].
2)WhenSQLappeared?
Itappearedin1974.
3)WhataretheusagesofSQL?
Toexecutequeriesagainstadatabase
Toretrievedatafromadatabase
Toinsertsrecordsinadatabase
Toupdatesrecordsinadatabase
Todeleterecordsfromadatabase
Tocreatenewdatabases
Tocreatenewtablesinadatabase
Tocreateviewsinadatabase
4)DoesSQLsupportprogramming?
No,SQLdoesn'[Link]
likecommandinglanguagetoaccessdatabases.
5)WhatarethesubsetsofSQL?
[Link](DDL)
[Link](DML)
[Link] 1/6
3/8/2016 SQLInterviewQuestionsjavatpoint
[Link](DCL)
6)Whatisdatadefinitionlanguage?
Datadefinitionlanguage(DDL)allowsyoutoCREATE,ALTERand
DELETEdatabaseobjectssuchasschema,tables,view,
sequenceetc.
7)Whatisdatamanipulationlanguage?
Datamanipulationlanguagemakesuserabletoaccessand
[Link].
Insertdataintodatabase
Retrievedatafromthedatabase
Updatedatainthedatabase
Deletedatafromthedatabase
8)Whatisdatacontrollanguage?
Datacontrollanguageallowsyoutocontrolaccesstothe
[Link].
GRANT:tograntspecificusertoperformspecifictask.
REVOKE:tocancelpreviouslydeniedorgrantedpermissions.
9)Whatarethetypeofoperatorsavailablein
SQL?
[Link]
[Link]
[Link]
10)Whatisthedifferencebetweenclustered
andnonclusteredindexinSQL?
[Link] 2/6
3/8/2016 SQLInterviewQuestionsjavatpoint
TherearemainlytwotypeofindexesinSQL,Clusteredindex
[Link]
indexesisveryimportantfromSQLperformanceperspective.
1)Onetablecanhaveonlyoneclusteredindexbutitcanhave
manynonclusteredindex.(approximately250).
2)clusteredindexdetermineshowdataisstoredphysicallyin
[Link],related
dataisstoredtogethersoitmakessimpletoretrievedata.
3)readingfromaclusteredindexismuchfasterthanreading
fromnonclusteredindexfromthesametable.
4)clusteredindexsortandstoredatarowsinthetableorview
basedontheirkeyvalue,whilenonclusterhaveastructure
separatefromthedatarow.
11)WhatistheSQLquerytodisplaycurrent
date?
ThereisabuiltinfunctioninSQLcalledGetDate()whichisused
toreturncurrenttimestamp.
12)WhichtypesofjoinisusedinSQLwidely?
TheknowledgeofJOINisverynecessaryforaninterviewee.
MostlyusedjoinisINNERJOINand(left/right)OUTERJOIN.
13)Whatis"TRIGGER"inSQL?
TriggerallowsyoutoexecuteabatchofSQLcodewhenan
insert,updateordeletecommandisexecutedagainstaspecific
table.
Actuallytriggersarespecialtypeofstoredproceduresthatare
definedtoexecuteautomaticallyinplaceorafterdata
modifications.
[Link] 3/6
3/8/2016 SQLInterviewQuestionsjavatpoint
14)Whatisselfjoinandwhatisthe
requirementofselfjoin?
Selfjoinisoftenveryusefultoconvertahierarchicalstructure
[Link]
thatisthesecondtable.
15)WhataresetoperatorsinSQL?
Union,intersectorminusoperatorsarecalledsetoperators.
16)Whatisaconstraint?Tellmeaboutits
variouslevels.
Constraintsarerepresentatorsofacolumntoenforcedata
[Link]:
[Link]
[Link]
17)WriteanSQLquerytofindnamesof
employeestartwith'A'?
1. SELECT*FROMEmployeesWHEREEmpNamelike'A%'
18)WriteanSQLquerytogetthirdmaximum
salaryofanemployeefromatablenamed
employee_table.
1. SELECTTOP1salary
2. FROM(
3. SELECTTOP3salary
4. FROMemployee_table
5. ORDERBYsalaryDESC)ASemp
6. ORDERBYsalaryASC
[Link] 4/6
3/8/2016 SQLInterviewQuestionsjavatpoint
19)WhatisthedifferencebetweenDELETE
andTRUNCATEstatementinSQL?
ThemaindifferencesbetweenSQLDELETEandTRUNCATE
statementsaregivenbelow:
No. DELETE TRUNCATE
1) DELETEisaDML TRUNCATEisaDDL
command. command.
2) WecanuseWHERE WecannotuseWHERE
clauseinDELETE clausewithTRUNCATE
command.
3) DELETEstatementis TRUNCATEstatementisused
usedtodeletearow toremovealltherowsfrom
fromatable atable.
4) DELETEisslowerthan TRUNCATEstatementisfaster
TRUNCATEstatement. thanDELETEstatement.
5) Youcanrollbackdata Itisnotpossibletorollback
afterusingDELETE afterusingTRUNCATE
statement. statement.
20)WhatisACIDpropertyindatabase?
ACIDpropertyisusedtoensurethatthedatatransactionsare
processedreliablyinadatabasesystem.
Asinglelogicaloperationofadataiscalledtransaction.
ACIDisanacronymforAtomicity,Consistency,Isolation,
Durability.
Atomicity:[Link]
meansifonepartofthetransactionfails,theentiretransaction
failsandthedatabasestateisleftunchanged.
Consistency:theconsistencypropertyensurethatthedata
[Link]
yourtransactionneverleavesyourdatabasewithoutcompleting
itsstate.
[Link] 5/6
3/8/2016 SQLInterviewQuestionsjavatpoint
Isolation:thispropertyensurethattheconcurrentpropertyof
[Link]
isolationisconcurrencycontrol.
Durability:durabilitysimplymeansthatonceatransactionhas
beencommitted,itwillremainso,comewhatmayevenpower
loss,crashesorerrors.
JavaBasics JavaOOPsInterview
InterviewQuestions Questions
JavaMultithreading JavaString&Exception
InterviewQuestions InterviewQuestions
JavaCollection JDBCInterview
InterviewQuestions Questions
ServletInterview JSPInterview
Questions Questions
SpringInterview HibernateInterview
Questions Questions
PL/SQLInterview SQLInterview
Questions Questions
OracleInterview AndroidInterview
Questions Questions
SQLServerInterview MySQLInterview
Questions Questions
[Link] 6/6