Create A Table Worker45 With A Following Attributes: Ecode, Name, Design, Plevel, Doj, Dob
Create A Table Worker45 With A Following Attributes: Ecode, Name, Design, Plevel, Doj, Dob
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
Table created.
1
4. Insert the values for the table paylevel45.
SQL> insert into paylevel45 values('p001',26000,12000);
1 row created.
1 row created.
1 row created.
2
6. Display all the tuples of the table paylevel45.
SQL> select*from paylevel45;
DESIGN
------------
clerk
mechanic
supervisor
operator
8. Display all the values of the attributes designation from the worker45.
SQL> select all design from worker45;
DESIGN
------------
supervisor
operator
operator
mechanic
clerk
3
9. To display the details of name,designation whose plevel is p003.
SQL> select name,design from worker45 where plevel='p003';
NAME DESIGN
------------ ------------
fizza operator
10. To display the details of name and designation whose plevel is either p001
or p002.
SQL> select name,design from worker45 where plevel='p001' or plevel='p002';
NAME DESIGN
--------------- ------------
11. To display the details of the name and designation whose plevel are p001
and p002.
SQL> select name,design from worker45 where plevel in('p001','p002');
NAME DESIGN
--------------- ------------
4
12. To display the details of the name and designation whose plevel are not
p001 and p002.
SQL> select name,design from worker45 where plevel not in('p001','p002');
NAME DESIGN
--------------- ------------
fizza operator
sanya clerk
13. Display all details from paylevel45 whose allowances ranges from 5000 to
10000(inclusive of both values)
14. Display all details from paylevel45 whose allowances ranges from 5000 to
10000(exclusive of both values)
SQL> select*from paylevel45 where allowance >5000 and allowance <10000;
5
15. Display all details from paylevel45 whose allowances not in the range from
5000 to 10000.
SQL> select*from paylevel45 where allowance not between 5000 and 10000;
16. Display all details from worker45 whose name starts with r.
17.Display all the details of worker45 whose name not starts with r.
SQL> select*from worker45 where name not like 'r%';
6
18. Display all the details of worker45 in descending order of designation.
SQL> select*from worker45 order by design desc;
19. To display the details of all worker45 in ascending order with name whose
ecode is more than 13
SQL> select*from worker45 where ecode>13 order by name;
7
20.Display the details of all workers in ascending order of name and
descending order of design.
SQL> select*from worker45 order by name asc,design desc;
21.Display the total amount of allowance from paylevel45 whose pay is more
than 15000.
SQL> select sum(allowance) from paylevel45 where pay>15000;
SUM(ALLOWANCE)
--------------
22000
8
22.Display the number of records present in the table worker45 and
paylevel45
SQL> select count(*) from worker45;
COUNT(*)
----------
COUNT(*)
----------
23.Display the maximum and the minimum pay of the worker45 in paylevel.
SQL> select max(pay),min(pay) from paylevel45;
MAX(PAY) MIN(PAY)
-------------- ----------
26000 12000
AVG(ALLOWANCE)
--------------------------
9333.3333
9
25. Display the number of designation of the worker that belongs to different
plevel.
SQL> select count(distinct design) from worker45;
COUNT(DISTINCTDESIGN)
--------------------------------------
COUNT(ALLNAME)
--------------------------
27. Display the number of plevel of each worker from each designation.
SQL> select count(plevel),plevel from worker45 group by plevel;
COUNT(PLEVEL) PLEV
----------------------- -----
1 p004
1 p001
1 p002
1 p005
1 p003
10
28. Display the number of designation of each worker whose count is more
than 1.
SQL> select count(design),design from worker45 group by design having count(design)>1;
COUNT(DESIGN) DESIGN
----------------------- ------------
2 operator
PLEV PAY+ALLOWANCE
------- --------------------------
p001 38000
p002 32000
p003 18000
---- --------------------------
p001 38000 $
p002 32000 $
p003 18000 $
11
31. Create a table workerinfo from table worker with the attributes doj,dob
and name .
SQL> create table workerinfo AS (select name, doj, dob from worker45 where name = chander
nath)
Table altered.
table modified.
12
34 . Insert the values for the column experience and display the table
worker45.
SQL> update worker45 set experience=10 where ecode=11;
1 row updated.
1 row updated.
1 row updated.
1 row updated.
1 row updated.
13
35.To display the name and pay of your worker45 whose ecode is less than 13.
SQL> select name,pay from worker45 w,paylevel45 p where w.plevel=p.plevel and
w.ecode<13;
NAME PAY
--------------- ----------
125*43
----------
5375
LOWER('
------------
Welcome
UPPER(
----------
THANKS
14
39.Delete the values of the table workerinfo whose names starts with c.
SQL> delete from workerinfo where name like 'c%';
1 row deleted.
Table dropped.
15