sign in
 
   
 
 
 
   
  SQL Tutorial: (Based on M.G. University - MSc Computer Science)  
 
SQL Lab Practice - 3
 
   
  Create the following tables  


Table - I ( EMPLY )
Data for Client_Master
Empcode
Empname
Address
Age
Dept_Code
E101
Anjaly
Anjaly Nivas, Thiruvalla
25
D301
E102
Bobby
Alapuzha
28
D305
E103
Aravind
Chennai
31
D305
E104
Lakshmi
Mannar
55
D707
E105
Daisy
Chaithram, Angamaly
35
D707
E106
Esha
Mumbai
23
D707
E107
Georgy
Pala
45
D909
E108
Prakash
Vennikulam
36
D110
E109
Madhavan
Mynakum, Kottayam
46
D202
E110
Anugraha
Aparna, Angamaly
47
D301
E111
Deva
Trichy
38
D301
E112
Saju
Dhanya, Ernakulam
27
D202
E113
Priyesh
Priya Nivas, Kottayam
26
D302


Table - II ( DEPT )
Data for Department
DEPTCODE
DEPTNAME
D301
Sales
D302
Account
D707
Research
D909
Advertising
D202
Stock
D110
Computer
D305
Marketing

Write SQL commands for the following:

1.

Display records from EMPY1 table for employees whose age is between 25 and 45.

2.

Retrieve the Deptcode and total no of employees in each department.

3.

Retrieve empcode, empname, address, deptcode for all employees in "account" and "stock" departments.

4.

Display average, maximum and minimum age of employees.

5.

Delete all records belonging to research department in the EMPY1 table.