0% found this document useful (0 votes)
8 views

2203A51431 Assignment 2

Uploaded by

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

2203A51431 Assignment 2

Uploaded by

anuragthippani8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

DEPARTMENT OF COMPUTER

SCIENCE
DATABASE MANAGEMENT SYSTEMS
Assignment-2
Name : N.SWARAN CHANDRA
Hall ticket no : 2203A51431
Section : B
Batch : 6
------------------------------------------------------------------------------------------------------------

Create an employee table with fields: Employee_id, first name, last


name, department, designation, experience, salary. Insert at least 15
tuples into the table, write SQL quires.

Command : create table swaran_1431 values

( &epid,’&fn’, ’&ln’,’&dept’,’&dsig’,&exp,&sal);

Display the schema of the table.

Command : desc swaran_1431;

Add a new column address to the table.

Commands : alter table swaran_1431 add addr char(20);


select * from swaran_1431;

Display the first name, last name and salary of the employees whose
experience is 5 years and above.

Command : select fn,ln,sal from swaran_1431 where exp>=5;

Display the names of the employees, who belong to CSE department


and has a salary of minimum 15k and an experience of minimum 2
years.

Command : select fn,ln from swaran_1431 where exp>=2 and dept=’cse’ and
sal>=15000;
Update the salary of the employee to 60k for those whose names start
with ‘A’.

Commands : update swaran_1431 set sal=60000 where fn like ‘a%’;

select * from swaran_1431;

Delete the details of an employee whose experience is more than 15


years.

Commands : delete from swaran_1431 where exp>=15;

select * from swaran_1431;

Increment the salary of an employee by 10%^whose name starts


with ‘S’.

Commands : update swaran_1431 set sal=sal+(sal*0.1) where fn like ‘s%’;


select * from swaran_1431;

Delete a column Lastname from the employee table.

Commands : alter table swaran_1431 drop column ln;

select * from swaran_1431;

Change the datatype of experience to number(4,2). [4 digits and 2


decimal values are allowed]

Commands : update swaran_1431 set exp = null;

alter table swaran_1431 modify exp number(4,2);


Sort the Id's of the employees who has a salary of 10k and above and
experience of 3 years and above in ascending order without
displaying duplicate values.

Command : select distinct ep_id from swaran_1431 where sal>=10000 and exp>=3
order by ep_id ASC;

You might also like