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

SQL Assignment 4

Uploaded by

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

SQL Assignment 4

Uploaded by

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

SQL Essential Training

User Assignment – 2

Problem Statement: (Other Key SQL Statements)

1. Insert into employee table with some more records

Ans: insert into employee values(1015,'Deep','Clerk','30',


str_to_date('11/4/2020','%m/%d/%Y'),10000);

2. Insert into employee table for only id, empName, designation,


department.

Ans: insert into employee values(1018,'Geeta','Clerk',null,null,null);


3. Update all the records, set the value of salary to 1000 whose salary is
null.

Ans: update employee set salary=1000 where salary is null;

4. Update the salary of employees increment 1000 to their salaries who


are working in department 20

Ans: update employee set salary=(salary+1000) where department=20


5. Update the empName to ‘Joe’ whose id is 1001.

Ans: update employee set empName='Joe' where id=1001

6. Update all the empName to ‘Biden’ , department to ‘20’, designation


to ‘president’ whose emp id is 1002.

Ans:

update employee set


empName='Biden',department=20,designation='President' where id=1002
7. Delete the employee record whose id is ‘1004’

Ans: delete from employee where id=1004

8. Delete the employee records who joined after ‘1997-01-10’

Ans: delete from employee where date_of_joining > ('1997/01/10');


9. Delete all the records from the table.

Ans: delete from employee;

10. Find the employee whose is getting maximum salary in the finance
department.

Ans: SELECT * FROM employee WHERE Salary IN ( SELECT


max(Salary) FROM employee where Department= 'finance' );
11. Display all the details of the employee whose is getting minimum
salary in the IT department.

Ans: SELECT * FROM employee WHERE Salary IN ( SELECT


min(Salary) FROM employee where Department= 'IT' );

12. Display all the details of the employee who is getting less salary than
the maximum salary of IT department employees.

Ans:
SELECT * FROM employee WHERE Salary < ( SELECT max(Salary)
FROM employee where department = 'IT' );

You might also like