You are on page 1of 28

S.

no TOPIC SIGNATURE
1 WAP to create student table with different parameters.
(name,enrollment no.,class,address,phone no.,father name)
That record 10 students databases.
2 WAP to create table employee table using constraints.
3 WAP to create table department by using constraints-
Primary key,unique key,not null key,check constraint.
4 WAP to create table which include different attributes-
Id, name, salary, address, date of joining, city, contact,
department.
5 Display the table/relation.
6 WAP to display structure of relation.
7 WAP to display salary from relation
8 Display diff. department from relation.
9 Display the name of those employees whose name start with
‘p’.
10 Display the name of those employees whose name start with
‘a’ and end with ‘a’.
11 find the total sum of salary of the employee from the table.
12 Display the average salary.
13 Display maximum salary of the employee from relation.
14 Display manimum salary of the employee from relation.
15 Display total number of salary from relation.
16 Increase salary of those employees where employee id=3
17 Create a table sales order details for sales information
18 W.A.P to retrieve product member & total quality order for
Product ‘p001’,’p004’ from the sales order details table
(with the help or group by and having command).
19 W.A.P in Oracle for join.
20 W.A.P to perform the equijoins on client master and sales
order.
21 W.A.P to modify th structure of the table.
22 W.A.P to drop a column form the table.
23 Modify the existing column of employee table relation
24 How to rename the relation
25 W.A.P to remove a specified row from table.
PRACTICAL – 1
Question:- WAP to create student table with different parameters.
(name,enrollment no.,class,address,phone no.,father name)
That record 10 students databases.

Answer:- create table student


(name varchar(20),
En_roll number(2),
class varchar(10),
address varchar(50),
phone number(10),
father_name varchar(20));
insert into student values('krishna',1,'bba cam','delhi',9874563210,'chauhan');
insert into student values('shanu',2,'bba cam','delhi',8874963210,'mk gupta');
insert into student values('anmol',3,'bba cam','palla',8649756321,'yashpal');
insert into student values('alok',4,'Bsc','delhi',784561235,'mk gupta');
insert into student values('aishwarya',5,'bcom','ghaziabad',7554896321,'rk');
insert into student values('nikil',6,'bba','noida',8445639904,'raj singh');
insert into student values('manas',7,'bcom','indrapuram',8699532174,'shiv');
insert into student values('nitish',8,'bsc','delhi',787482211,'rampal singh');
insert into student values('kejriwal',9,'bcom','delhi',477477321,'sanjay ');
insert into student values('kavya',10,'bba','delhi',8874500214,'manish ');
PRACTICAL – 2
Question:- WAP to create table employee table using constraints.

Query:- create table employee


(employee_id number(2) primary key,
ename varchar(10) not null,
floor number(1) not null);
PRACTICAL – 3
Question:- WAP to create table department by using constraints-
Primary key,unique key,not null key,check constraint.

Query:- create table department


(code number(10) primary key,name varchar(10) not null unique check(name
in('research','accounts','sales')),floor number(1) not null);
PRACTICAL – 4
Question:- WAP to create table which include different attributes-
Id, name, salary, address, date of joining, city, contact, department.

Query:- create table comp


(id number(5),
name varchar(10),
salary number(5),
address varchar(100),
date_of_joining date,
city varchar(10),
contact number(10),
department varchar(10));
PRACTICAL – 5
Question:- Display the table/relation.

Query:- select * from comp;


PRACTICAL – 6
Question:- WAP to display structure of relation.

Query:- desc comp;


PRACTICAL – 7
Question:- WAP to display salary from relation.

Query:- select salary from comp;


PRACTICAL – 8
Question:- Display diff. department from relation.

Query:- select distinct department from comp;


PRACTICAL – 9
Question:- Display the name of those employees whose name start with ‘p’.

Query:- select name from comp where name like'p%';


PRACTICAL – 10

Question:- Display the name of those employees whose name start with ‘a’ and end
with ‘a’.

Query:- select name from comp where name like'a%' and name like'%a';
PRACTICAL – 11

Question:- find the total sum of salary of the employee from the table.

Query:- select sum(salary) from comp;


PRACTICAL – 12

Question:- Display the average salary.

Query:- select avg(salary) from comp;


PRACTICAL – 13

Question:- Display maximum salary of the employee from relation.

Query:- select max(salary) from comp;


PRACTICAL – 14
Question:- Display manimum salary of the employee from relation.

Query:- select min(salary) from comp;


PRACTICAL – 15
Question:- Display total number of salary from relation.

Query:- select count(salary) from comp;


PRACTICAL – 16
Question:- Increase salary of those employees where employee id=3

Answer:- update employee set salary=salary+2000 where id=3;


PRACTICAL – 17
Question:- Create a table sales order details for sales information

Answer:- create table sales_order_details


(order_no number(6),P_no varchar(4),QO_no number(2),Q_disp
number(2));
PRACTICAL – 18
Question:- W.A.P to retrieve product member & total quality order for
Product ‘p001’,’p004’ from the sales order details table
(with the help or group by and having command).

Answer:-select p_no,sum(qo_no)"total qty ordered" from sales_order_details


group by p_no having p_no='p001' or p_no='p004';
PRACTICAL – 19

Question:- W.A.P in Oracle for join.

Answer:-
A) Create table sales_order(order_no number(6),client_no varchar(4),order_date
date);
B) Create table client_master(client_id varchar(10), name varchar(10), balance_due
number(4));
PRACTICAL – 20

Question:- W.A.P to perform the equijoins on client master and sales order.

Answer:- select sales_order.order_no, client_master.name, sales_order.order_date


from sales_order,client_ master;
PRACTICAL – 21

Question:- W.A.P to modify the structure of the table.

Answer:- alter table employee add(e_email varchar(12));


PRACTICAL – 22

Question:- W.A.P to drop a column form the table.

Answer:- alter table employee drop column id;


PRACTICAL – 23

Question:- Modify the existing column of employee table relation

Answer:- alter table employee modify(name varchar(20));


PRACTICAL – 24

Question:- How to rename the relation

Answer:- rename employee to work;


PRACTICAL – 25

Question:- W.A.P to remove a specified row from table.

Answer:- delete from comp where salary=10000;

You might also like