Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
60 views

SQL Interview Question

This document appears to contain sample SQL queries and questions about concepts like filtering, sorting, concatenation and wildcard characters. It includes queries to select, filter, order and manipulate data from an employee table for examples like getting employee names, salaries, ordering results and using wildcards in WHERE clauses.

Uploaded by

pandian25
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

SQL Interview Question

This document appears to contain sample SQL queries and questions about concepts like filtering, sorting, concatenation and wildcard characters. It includes queries to select, filter, order and manipulate data from an employee table for examples like getting employee names, salaries, ordering results and using wildcards in WHERE clauses.

Uploaded by

pandian25
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

"#$L%&""'ID (I)ST'N*#" 1 2 3 % ' & " 8 Jhon Michael Ro !om Jerr (hili* !es)Name1 !

es)Name2

L*ST'N*#" Abraham Clarke !homas Jose (in)o Ma)he+ 123 .name/

S*L*)& 1000000 800000 "00000 &00000 &'0000 "'0000 &'0000 &00000

+%INING'D*T" 01-JAN-13 12.00.00 AM 01-JAN-13 12.00.00 AM 01-#$B-13 12.00.00 AM 01-#$B-13 12.00.00 AM 01-#$B-13 12.00.00 AM 01-JAN-13 12.00.00 AM 01-JAN-13 12.00.00 AM 01-#$B-13 12.00.00 AM

D"$*)T#"NT Banking Insurance Banking Insurance Insurance ,er-ices ,er-ices Insurance

Table Name : Incentives

EMPLOYEE_REF_ID INCENTIVE_DATE 1 2 3 1 2 01-FEB-13 01-FEB-13 01-FEB-13 01-JAN-13 01-JAN-13

INCENTIVE_AMOUNT 5000 3000 4000 4500 3500

Database SQL Queries Interview Questions and answers on "SQL Select"


1. Get all employee details rom t!e employee table
Select * from employee

,. Get (irst'Name-Last'Name rom employee table


Select first_name, Last_Name from employee

3. Get (irst'Name rom employee table usin. alias name /"mployee Name0
Select first_name Employee Name from employee

%. Get (irst'Name rom employee table in upper case


Select upper(FIRST_NAME) from EM L!"EE

'. Get (irst'Name rom employee table in lower case


,elec) lo+er0#IR,!1NAM$2 3rom $M(.45$$

&. Get uni1ue D"$*)T#"NT rom employee table


selec) 6is)inc) 7$(AR!M$N! 3rom $M(.45$$

". Select irst 2 c!aracters o (I)ST'N*#" rom "#$L%&"" %racle "1uivalent o SQL Server S34ST)ING is S34ST)8 9uer : selec) subs)r0#IR,!1NAM$80832 3rom em*lo ee SQL Server "1uivalent o %racle S34ST) is S34ST)ING8 9uer : selec) subs)ring0#IR,!1NAM$80832 3rom em*lo ee #ySQL Server "1uivalent o %racle S34ST) is S34ST)ING. In #ySQL start position is 18 9uer :selec) subs)ring0#IR,!1NAM$81832 3rom em*lo ee 8. Get position o 5o5 in name 5+!on5 rom employee table
%racle "1uivalent o SQL Server 67*)IND"8 is INST)8 9uer : ,elec) ins)r0#IR,!1NAM$8;o;2 3rom em*lo ee +here 3irs)1name < ;Jhon; SQL Server "1uivalent o %racle INST) is 67*)IND"8 89uer : ,elec) C=ARIN7$>0;o;8#IR,!1NAM$802 3rom em*lo ee +here 3irs)1name < ;Jhon; #ySQL Server "1uivalent o %racle INST) is L%6*T" 8 9uer : ,elec) .4CA!$0;o;8#IR,!1NAM$2 3rom em*lo ee +here 3irs)1name < ;Jhon;

?. Get (I)ST'N*#" rom employee table a ter removin. w!ite spaces rom ri.!t side
selec) R!RIM0#IR,!1NAM$2 3rom em*lo ee

10. Get (I)ST'N*#" rom employee table a ter removin. w!ite spaces rom le t side
selec) .!RIM0#IR,!1NAM$2 3rom em*lo ee

11. Get len.t! o (I)ST'N*#" rom employee table


%racle-#&SQL "1uivalent o SQL Server Len is Len.t! 8 9uer :selec) leng)h0#IR,!1NAM$2 3rom em*lo ee SQL Server "1uivalent o %racle-#&SQL Len.t! is Len8 9uer :selec) len0#IR,!1NAM$2 3rom em*lo ee

12. Get (irst'Name rom employee table a ter replacin. 5o5 wit! 595
selec) R$(.AC$0#IR,!1NAM$8;o;8;@;2 3rom em*lo ee

13. Get (irst'Name and Last'Name as sin.le column rom employee table separated by a 5'5 %racle "1uivalent o #ySQL concat is 5::58 9uer : ,elec) #IR,!1NAM$AA ;1; AA .A,!1NAM$ 3rom $M(.45$$ SQL Server "1uivalent o #ySQL concat is 5;58 9uer : ,elec) #IR,!1NAM$ B ;1; B.A,!1NAM$ 3rom $M(.45$$ #ySQL "1uivalent o %racle 5::5 is concat8 9uer : ,elec) conca)0#IR,!1NAM$8;1;8.A,!1NAM$2 3rom $M(.45$$ 1%. Get (I)ST'N*#" -+oinin. year-+oinin. #ont! and +oinin. Date rom employee table SQL Queries in %racle8 ,elec) #IR,!1NAM$8 )o1char0Coining16a)e8;5555;2 Join5ear 8 )o1char0Coining16a)e8;Mon;28 )o1char0Coining16a)e8;66;2 3rom $M(.45$$ SQL Queries in SQL Server8 selec) ,DB,!RINE 0con-er)0-archar8Coining16a)e810328"8%2 8 ,DB,!RINE 0con-er)0-archar8Coining16a)e8100281832 8 ,DB,!RINE 0con-er)0-archar8Coining16a)e810028'822 3rom $M(.45$$ SQL Queries in #ySQL8 selec) ear0Coining16a)e28mon)h0Coining16a)e28 7A50Coining16a)e2 3rom $M(.45$$

Database SQL Queries Interview Questions and answers on "SQL %rder 4y"
1'. Ee) all em*lo ee 6e)ails 3rom )he em*lo ee )able or6er b #irs)1Name Ascen6ing ,elec) F 3rom em*lo ee or6er b #IR,!1NAM$ asc 1&. Ee) all em*lo ee 6e)ails 3rom )he em*lo ee )able or6er b #irs)1Name 6escen6ing ,elec) F 3rom em*lo ee or6er b #IR,!1NAM$ 6esc 1". Ee) all em*lo ee 6e)ails 3rom )he em*lo ee )able or6er b #irs)1Name Ascen6ing an6 ,alar 6escen6ing ,elec) F 3rom em*lo ee or6er b #IR,!1NAM$ asc8,A.AR5 6esc

Database SQL Queries Interview Questions and answers on "SQL <!ere 6ondition"
18. Ee) em*lo ee 6e)ails 3rom em*lo ee )able +hose em*lo ee name is GJhonH ,elec) F 3rom $M(.45$$ +here #IR,!1NAM$ < ;Jhon; 1?. Ee) em*lo ee 6e)ails 3rom em*lo ee )able +hose em*lo ee name are GJhonH an6 GRo H ,elec) F 3rom $M(.45$$ +here #IR,!1NAM$ in 0;Jhon;8;Ro ;2 20. Ee) em*lo ee 6e)ails 3rom em*lo ee )able +hose em*lo ee name are no) GJhonH an6 GRo H ,elec) F 3rom $M(.45$$ +here #IR,!1NAM$ no) in 0;Jhon;8;Ro ;2

Database SQL Queries Interview Questions and answers on "SQL <ild 6ard"
21. Ee) em*lo ee 6e)ails 3rom em*lo ee )able +hose 3irs) name s)ar)s +i)h ;J; ,elec) F 3rom $M(.45$$ +here #IR,!1NAM$ like ;J/; 22. Ee) em*lo ee 6e)ails 3rom em*lo ee )able +hose 3irs) name con)ains ;o; ,elec) F 3rom $M(.45$$ +here #IR,!1NAM$ like ;/o/; 23. Ee) em*lo ee 6e)ails 3rom em*lo ee )able +hose 3irs) name en6s +i)h ;n; ,elec) F 3rom $M(.45$$ +here #IR,!1NAM$ like ;/n;

You might also like