DBMS Assignment
DBMS Assignment
Experiment No. 01
Using the default table of Oracle given above.
Write SQL queries for the following :
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
(j)
(k)
(l)
Experiment No. 02
Write SQL queries for the following.
(a) List the names and job of all employees who have names exactly 5 characters in
length.
(b) List all employees whose names start with G .
(c) List all employees who name ends with N.
(d) List the names and job of all employees who have names exactly 5 characters in
length and ends with S.
(e) List all employees who have not joined between 1/1/81 and 31/12/81.
(f) List all employees whose job does not start will CL.
(g) List all managers who earn more than Rs. 4000/-.
(h) List all clerks and salesman who earn more than Rs. 1600/(i) List the names and salaries of all employees who were joined as manager during
1981.
Experiment No. 03
For the EMP relation, frame the following queries using SQL.
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
(j)
(k)
List all employee names, dept name and the city, in department name order.
List all employee name, dept number, dept name and salary.
List all employees working in Dallas in descending order of salary.
List all employees name, job, salary and department name for everyone in the
company except clerks. Sort the report with respect to job and salary.
(e) List all employee names who work in the same city as an employee named FORD.
(f) Display the name of the dept that has no employee.
Experiment No. 05
a)
b)
c)
d)
e)
f)
g)
h)
i)
j)
k)
l)
m)
n)
o)
p)
q)
r)
s)
t)
u)
v)
w)
x)
y)
z)
Experiment No. 06
a)
b)
c)
d)
e)
f)
g)
h)
i)
j)
k)
l)
m)
n)
o)
(d)
(e)
(f)
(g)
Description
Character string
Character string (max length 20)
Number
number
number
date
Experiment No. 9
Using the default table of Oracle, such as Emp and Dept.
a) Define a view according to the following output :
Deptno
10
20
30
NaxSal
5000
3000
2850
MinSal
1400
800
950
No. of emp
3
5
6
b) From the transaction table define a view of all deposits done in last 2 months.
Experiment No. 10
1> Write a PL/SQL block which will accept two values, one for lower range and one for
upper range from the user and it will insert the factorial results within a given range
into a table called Result.
2> Write a block which will accept an empno and check his salary, if it is less then 2000
then increment it by 20% of the salary.
Experiment No. 11
1. Write a PL/SQL block of code for inverting any number given by user.
2. The HRD manager has decided to raise the salary of employee by 0.15. Write a
PL/SQL block with implicit cursors to accept the employee number and update
the salary of the employee. Display appropriate message based on the existence of
the record in the employee table.
Experiment No. 12
Create a row trigger which will execute after updation or deletion of client_master
in such a way that it will insert the old client_number, old_balance, operation and
system date into new table audit.
Table to be created as follows:
Client_master(client_no varchar2(6), name varchar2(20), balance_due
number(10,2))
audit(client_no varchar2(6), balance number(10,2), operation varchar2(6), sysdate
date)
Experiment No. 13
Create a row trigger (before trigger) in such a way whenever the dispatched
quantity in challan_details is inserted as zero or negative the trigger fires by
giving message despatch quantity can not be less than equal to zero. If it is +ve
then the trigger will execute to update the order table by updating the balance
quantity.
Table to created as follows :
Order(order_no varchar2(6) primary key, balance_quantity number(10,2))
Chall_dtls(order_no varchar2(6), prod_no varchar2(6), qnty_desp number(10,2)
primary key(order_no, prod_no), foreign key (order_no) references order)