You are on page 1of 9

PART II Write SQL statements for questions 1 to 5 using the table EMP Empno 1#1# 1#+, 1#,' 1#55

1#5/ 1#&+ 1#&) 1#&& EName $aran Di-a.ar Di-!a 0tul 1riti. 0.sha! 03a! San3a! DOJ #1%#&%'# #1%#,%') #1%#5%/) #1%#/%/5 #1%#&%/2 #1%#'%// #1%1#%// #1%#+%## Job Dire(tor Manager Programmer 0nal!st Programmer Manager "ler. Salesman Dept no )# 1# +# +# +# ,# 1# ,# Salar! )'*### +#*### )#*### )5*### )#*### +5*### 1+*### 15*### 5### "omm

14 Displa! 5etails of all emplo!ees 6ho earn bet6een 1#### an5 +5###

+4 7in5 the number of emplo!ees in the ea(h 5epartment

,4 "reate a -ie6 (ontaining 5etails of emplo!ees of 5epartment number +#

)4 Displa! 5etails of all emplo!ees a((or5ing to their 5epartment an5 seniorit!

54 7in5 all emplo!ees 6ho are not managers

PART II Write SQL statements for questions 1 to 5 using the table EMP Empno 1#1# 1#+, 1#,' 1#55 1#5/ 1#&+ 1#&) 1#&& EName $aran Di-a.ar Di-!a 0tul 1riti. 0.sha! 03a! San3a! DOJ #1%#&%'# #1%#,%') #1%#5%/) #1%#/%/5 #1%#&%/2 #1%#'%// #1%1#%// #1%#+%## Job Dire(tor Manager Programmer 0nal!st Programmer Manager "ler. Salesman Dept no )# 1# +# +# +# ,# 1# ,# Salar! )'*### +#*### )#*### )5*### )#*### +5*### 1+*### 15*### 5### "omm

14 7in5 the lo6est pai5 emplo!ee Sele(t empname*min8salar!9 from emp: +4 List a-erage salar! of programmers Sele(t a-g8salar!9 from emp 6here 3ob;<Programmer<: ,4 List the emplo!ees 6ho earn a salar! greater than the a-erage salar! earne5 b! the emplo!ees of 5ept 1# Sele(t empname* salar! from emp 6here salar! = 8sele(t a-g8salar!9 from emp 6here 5eptno;1#9: )4 Displa! name* annual salar! an5 (ommission of all salesmen 6hose monthl! salar! is greater than (ommission Sele(t empname* salar!>1+* (omm4 7rom emp Where salar! =(omm an5 3ob ;<Salesman<: 54 7in5 the number of 5epartments Sele(t 5eptno* (ount85eptno9 from emp group b! 5eptno:

PART II Write SQL statements for questions 1 to 5 using the table EMP Empno 1#1# 1#+, 1#,' 1#55 1#5/ 1#&+ 1#&) 1#&& EName $aran Di-a.ar Di-!a 0tul 1riti. 0.sha! 03a! San3a! DOJ #1%#&%'# #1%#,%') #1%#5%/) #1%#/%/5 #1%#&%/2 #1%#'%// #1%1#%// #1%#+%## Job Dire(tor Manager Programmer 0nal!st Programmer Manager "ler. Salesman Dept no )# 1# +# +# +# ,# 1# ,# Salar! )'*### +#*### )#*### )5*### )#*### +5*### 1+*### 15*### 5### "omm

14 055 an attribute 0nnual sal to store the annual salar!

+4 List all emplo!ees 6ho 3oine5 before 1//5

,4 ?n(rease the salar! of Di-a.ar b! 5###

)4 List the ma@imum an5 minimum salar! of ea(h 3ob t!pe

54 List the emplo!ee 6hose (ommission is greater than their salar!

PART II Write SQL statements for questions 1 to 5 using the table EMP Empno 1#1# 1#+, 1#,' 1#55 1#5/ 1#&+ 1#&) 1#&& EName $aran Di-a.ar Di-!a 0tul 1riti. 0.sha! 03a! San3a! DOJ #1%#&%'# #1%#,%') #1%#5%/) #1%#/%/5 #1%#&%/2 #1%#'%// #1%1#%// #1%#+%## Job Dire(tor Manager Programmer 0nal!st Programmer Manager "ler. Salesman Dept no )# 1# +# +# +# ,# 1# ,# Salar! )'*### +#*### )#*### )5*### )#*### +5*### 1+*### 15*### 5### "omm

14 7in5 the number of salesmen

+4 List a-erage salar! of all 5epartments 6hi(h ha-e more than , emplo!ees

,4 "reate a -ie6 5ept1# (ontaining empno* ename an5 annual salar! of emplo!ees in the 5ept 1#

)4 7in5 the 3obs that 6ere fille5 in the first half of 1//5

54 ?nsert a ro6 6ith the follo6ing 5etailsA 1#5/* Ba3esh* #1C1#C+###* salesman* ,#* 1+###* +###

PART II Write SQL statements for questions 1 to 5 using the table EMP Empno 1#1# 1#+, 1#,' 1#55 1#5/ 1#&+ 1#&) 1#&& EName $aran Di-a.ar Di-!a 0tul 1riti. 0.sha! 03a! San3a! DOJ #1%#&%'# #1%#,%') #1%#5%/) #1%#/%/5 #1%#&%/2 #1%#'%// #1%1#%// #1%#+%## Job Dire(tor Manager Programmer 0nal!st Programmer Manager "ler. Salesman Dept no )# 1# +# +# +# ,# 1# ,# Salar! )'*### +#*### )#*### )5*### )#*### +5*### 1+*### 15*### 5### "omm

14 Di-e an in(enti-e of Bs45### for the emplo!ees 6ho 3oine5 before 1//#

+4 List the emplo!ees of soft6are 5epartment 5ra6ing salar! less than )#*###

,4 List the emplo!ee 6ho earns the highest in his%her 5epartment

)4 7in5 the 5epartments that ha-e more than + t!pes of 3ob

54 Delete the emplo!ee 6ith (o5e 1#1#

PART II Write SQL statements for questions 1 to 5 using the table EMP Empno 1#1# 1#+, 1#,' 1#55 1#5/ 1#&+ 1#&) 1#&& EName $aran Di-a.ar Di-!a 0tul 1riti. 0.sha! 03a! San3a! DOJ #1%#&%'# #1%#,%') #1%#5%/) #1%#/%/5 #1%#&%/2 #1%#'%// #1%1#%// #1%#+%## Job Dire(tor Manager Programmer 0nal!st Programmer Manager "ler. Salesman Dept no )# 1# +# +# +# ,# 1# ,# Salar! )'*### +#*### )#*### )5*### )#*### +5*### 1+*### 15*### 5### "omm

14 Di-e the (omman5 to (reate the table EMP 6ith the follo6ing (onstraints Empno E NOF NGLL* primar! .e! Ename E NOF NGLL Salar! E Default 1+### an5 salar! =1+### an5 H 5####

+4 List the lo6est pai5 manager

,4 7in5 the a-erage salar! an5 a-erage total remuneration for ea(h t!pe4 Bemember salesmen earn (ommission

)4 7in5 all 5epartments 6hi(h ha-e more than + emplo!ees

PART II Write SQL statements for questions 1 to 5 using the table EMP Empno 1#1# 1#+, 1#,' 1#55 1#5/ 1#&+ 1#&) 1#&& EName $aran Di-a.ar Di-!a 0tul 1riti. 0.sha! 03a! San3a! DOJ #1%#&%'# #1%#,%') #1%#5%/) #1%#/%/5 #1%#&%/2 #1%#'%// #1%1#%// #1%#+%## Job Dire(tor Manager Programmer 0nal!st Programmer Manager "ler. Salesman Dept no )# 1# +# +# +# ,# 1# ,# Salar! )'*### +#*### )#*### )5*### )#*### +5*### 1+*### 15*### 5### "omm

14 Bemo-e the ro6 6hi(h has an! of empnoA 1#1#* 1#,'* 1#&+

+4 0ssume that there is one more table DEPF in the 5atabase as sho6n belo6A Dept no Dname Lo(ation 1# 0((ounts Ja!anagar +# Soft6are ?n5iranagar ,# Sales Ba3a3inagar )# Besear(h $oramangala Di-e the quer! to 5ispla! number* name* 5ept* lo(ation of emplo!ees earning more than +5###

,4 Di-e the quer! to 3oin the t6o tables EMP an5 DEPF

)4 List the total number of emplo!ees

PART I 19 Write SQL (omman5s for 8a9 to 859 using the follo6ing table 7B?ENDS A No 1 + , ) 5
a9

Name $aran Di-a.ar Di-!a 0tul San3a!

055ress 1)* Dol5en En(la-e )5* Jasant Jihar ,#* Son! Jilla ,5* Sil-er Ferra(e 5* Wilson Dar5en

DOI #1C#1C1/'# 1#C#+C1/'1 15C#,C1/'1 +'C#5C1/'# 1'C#&C1/'+

0ge 1' 12 12 1' 1&

055 a ne6 (olumn* phone number to the table 7B?ENDS

b9

List the names in the as(en5ing or5er of age

(9

?n(rease age b! 1 for all those born bet6eeen Januar! an5 Mar(h

59

Displa! all names 6hi(h ha-e r or ! in them

+9 a9

Di-e the output of the follo6ing (omman5sA Sele(t M?N8age9 from frien5s:

b9

Sele(t "OGNF8>9 from frien5s 6here age H; 12:

PART I 19 Write SQL (omman5s for 8a9 to 859 using the follo6ing table 7B?ENDS A No 1 + , ) 5
a9

Name $aran Di-a.ar Di-!a 0tul San3a!

055ress 1)* Dol5en En(la-e )5* Jasant Jihar ,#* Son! Jilla ,5* Sil-er Ferra(e 5* Wilson Dar5en

DOI #1C#1C1/'# 1#C#+C1/'1 15C#,C1/'1 +'C#5C1/'# 1'C#&C1/'+

0ge 1' 12 12 1' 1&

"reate a -ie6 (ontaining name* a55ress

b9

"hange a55ress to 1* Bam Sa5an for name ; San3a!

(9

055 a ne6 ro6 to the table4 Gse the follo6ing 5ata A Ba-i* )5* Bose Dar5en* +#C#'C'1* 12

59

List all those frien5s 6ho are born in the !ear 1/'1

+9 a9

Di-e the output of the follo6ing (omman5sA Sele(t M0K8age9 from frien5s:

b9

Sele(t "OGNF8D?SF?N"F age9 from frien5s:

You might also like