0% found this document useful (0 votes)
1K views6 pages

SQL Interview Questions - Javatpoint

This document contains 20 SQL interview questions and their answers. Some of the key questions addressed are: What is SQL?, When did SQL appear?, What are the main uses of SQL?, What are the different types of SQL languages (DDL, DML, DCL)?, What is the difference between clustered and non-clustered indexes?, What is the SQL query to display the current date?, What types of joins are commonly used in SQL?

Uploaded by

R Vuppula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views6 pages

SQL Interview Questions - Javatpoint

This document contains 20 SQL interview questions and their answers. Some of the key questions addressed are: What is SQL?, When did SQL appear?, What are the main uses of SQL?, What are the different types of SQL languages (DDL, DML, DCL)?, What is the difference between clustered and non-clustered indexes?, What is the SQL query to display the current date?, What types of joins are commonly used in SQL?

Uploaded by

R Vuppula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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

You might also like