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

Practical List DBMS

Nothing

Uploaded by

pk2422927
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)
23 views

Practical List DBMS

Nothing

Uploaded by

pk2422927
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/ 4

**1.

Create a table EMPLOYEE with following schema:

Emp(Emp_no as primary key, E_name,, Dept_no, Dept_name, Job_id, Salary,hiredate)

1.Change the emp table structure by adding column city.

2. Increase the size by 10 of E_name column

3. Drop column Job_id from Emp

4 .Insert 5 rows in the above table Emp using INSERT command of SQL.

5. Delete Emp where E_name=Shreyas;

6.. Update set salary =50000 where dept_name=production

7. Select * from where salary >=25000 and <=60000.

**1. Create a table EMPLOYEE with following schema: Emp(Emp_no, E_name,, Dept_no,
Dept_name,Job_id, Salary,hiredate)

Write SQL queries for following question:

a. Insert at least 5 rows in the table.

b. Display all the information of EMP table.

C.Display the information of employees working in department PRODUCTION and salary above
40000.

d. Update the salary of employees to 30000 working in department sales.

e.Delete the employee working in SALES department having salary below 10000.

f. Display the complete record of employees working in SALES Department.

h.Update deptno of employee Shreyas to 201.

**1. Consider the table EMPLOYEE

Emp(Emp_no, E_name,, Dept_no, Dept_name,Job_id, Salary,hiredate).

and write output of the following queries:

a. Select E_name,(Salary*.20) as Incremented_Salary from Emp;

b. Select E_name,Emp_no from Emp where Salary <=50000 and >=25000;

c. Select details of employess having salary more than Ashish Salary;

d. Select * from Emp where Dept_no<> 201;

**1. Create Schema Emp(Emp_no, E_name,, Dept_no, Dept_name,Job_id, Salary,hiredate).


Dept,Dept_no,Location,job_id);

Execute and write output of the following queries

i. Select dept_no from Emp union Select dept_no from Dept;

ii. Select dept_no Emp intersect Select dept_no from Dept;

iii. Select dept_no from Emp minus Select dept_no from Dept;

iv. Select * from Emp where salary Emp_no between 100 and 200;

v. Select * from Emp where E_name IN('Shreyas');

**Q1. Create Emp(Emp_no, E_name,, Dept_no, Dept_name,Job_id, Salary, hiredate).

a. Display the name of employees having salary greater than 40000 & working sales department.

b. Display the name of employees who are not working in sales department.

c. Display the name of employees starting with letter S.

d. Display the name of employees ending with letter E.

e. Update salary of john to 50000.

2. Write Output of the following

a) Select abs(-15) from dual.

b) Select power(4,2) from dual; d) Select mod(10,3) from dual; e) Select sqrt(16) from dual;

**1. Write Output of the following queries:

a) select concat('Shreyas','NBA') from dual;

b) select Itrim('shreyasss', 's') from dual;

c) select rtrim('shreyasss','s') from dual;

d) select lower('SALES') from dual;

2.Write Output of the following queries:

a) select sysdate from dual;

b) select next _day(sysdate, 'Tuesday') from dual;

c) select add_months(sysdate,2) from dual;

d) select last_day(sysdate) from dual;

e) select months_ between(sysdate,hiredate) from Emp;


A. select upper('production') from dual;

B. select length('sales') from dual;

C. select substr('production sales',3,4) from dual;

D. select instr('production','ro',3,2) from dual;

F.select greatest('10-jan-07','12-oct-07') from dual;

**2. Write SQL Queries for the following:

.Consider the table Emp(Emp_no, E_name,, Dept_no, Dept_name,Job_id, Salary, location)

a. Display information of employees whose salary is greater than average salary of all employees.

b. Display total employees in sales department with its location.

C. Display total salaries of employees working in production department.

d. Display maximum and minimum salary of employees.

**1.Create a tables EMPLOYEE and DEPARTMENT with following schema:

Emp(empno,empname, salary, phno)

Dept(deptno,deptname, location.jobtype)

1. Write Output of the following queries:

a) Select empno,sum(salary) from Emp e, Dept d where e.empno=d.deptno group by empno;

b) Select deptno from Dept order by deptname;(Descending order)

c) Select min(salary) from Emp e,Dept d where e.empno=d.deptno group by empno;

d) Select empno, jobtype from Dept order by deptname;(Ascending order)

2. Write Output of the following queries:

a) Display minimum salary of employee from every department.

b) Display total salary of every department.

d) Display details of employees with the employee name in ascending order.

**1Create a tables EMP and DEPT with following schema:

Emp(empno,deptno,empname, salary, phno)

Dept(deptno ,deptname, location.jobtype)

1. Write output of following query


Select *from emp LEFT OUTER JOIN dept on emp.deptno-=dept.deptno;

Select * from emp RIGHT OUTER JOIN dept on emp.deptno=dept.deptno;

Select * from emp FULL OUTER JOIN dept on emp.deptno=dept.deptno;

Select e.empno,e.empname ,d.deptname from emp e NATURAL JOIN dept d;

Select empname from emp INNER JOIN dept on emp.deptno-=dept.deptno

**Consider tables DEPARTMENT with following schema

Dept(deptno, deptname, location.jobtype)

1. Create user john and implement the following commands on table Dept.

2. Write a query to grant select, insert,delete privileges on Dept table.

3. Write a query to grant update privileges on columns detpno and location on Dept table

4. Write a query to revoke all above privileges from Dept table.

5. Write query to create role dept_pvr;

6. Write query to assign system privileges-create table,create view to role dept_pvr;

7. Write query to assign above system privileges to users jyoti and john.

8. Write query to assign object privileges-select, insert, delete to role dept_pvrl;

9. Write query to assign above object privileges to users jyoti and john.

You might also like