Shashwat Arya - 0201bca153 - Lab On Oracle File

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

LAB ON ORACLE

PRACTICAL FILE

Submitted by: Submitted to:


SHASHWAT ARYA MR. AJAY KUMAR
BCA-III MORNING (2020-23)
0201BCA153

ASSIGNMENT – 1
Q.1 create table emp1(
empno number(4,0),
ename varchar2(10),
job varchar2(9),
mgr number(4,0),
hiredate date,
sal number(7,2),
comm number(7,2),
deptno number(2,0));

(I) Insert 14 records .

 QUERY TO CREATE TABLE :

 QUERY TO INSERT RECORDS IN THE TABLE :


ASSIGNMENT – 2
Q.2 Create Table:
BILL (Bill_no, Bill_date, Amount, Tax, Total_amt)
Queries:
I. INSERT 5 RECORDS

(i) Display all the bill details of ‟24-jan-12‟

(ii) Display the bill details where total amount is greater than 6000.

(iii) Display the bill details where total amount is less than 500

II. To perform queries for the table “BILL” using various DDL,DML and DQL
commands.
(i) Add a column „number_of_items‟ to BILL table.

(ii) Rename the table „BILL‟ to „BILL_DETAILS‟.

(iii) Update the bill amount of 24-JAN-12.

(iv) Display the bill no. and total amount multiplied by 3

 QUERY TO INSERT RECORDS IN THE TABLE :

 Queries performed:
(i) Display all the bill details of ‟24-jan-12‟

(ii) Display the bill details where total amount is greater than 6000.

(iii) Display the bill details where total amount is less than 500

 To perform queries for the table “BILL” using various DDL,DML and DQL
commands.

(i) Add a column „number_of_items‟ to BILL table.

(ii) Rename the table „BILL‟ to „BILL_DETAILS‟.


(iii) Update the bill amount of 24-JAN-12.

(iv) Display the bill no. and total amount multiplied by 3


ASSIGNMENT – 3
Q.3 CAR(Regn_no, Make, Colour, Model, Owner)

Queries:

(i) Insert 5 records

(ii) Display the owners who does not own a Maruti

(iii) Display the car details of car make Hyundai‟

(iv)Display model and owners from CAR

(v) Display the car details whose car colour is RED‟

(vi) Delete all the details of car Hyundai

(vii) Update the car color from RED to METTALIC_RED

(i) Insert 5 records


(ii) Display the owners who does not own a Maruti

(iii) Display the car details of car make Hyundai

(iv) Display model and owners from CAR

(v) Display the car details whose car color is RED‟


(vi) Delete all the details of car Hyundai

(vii) Update the car color from RED to METTALIC_RED


ASSIGNMENT – 4
CREATE TABLE – DEPARTMENT AND INSERT FOLLOWING RECORDS

 create table dept(

 deptno number(2,0),

 dname varchar2(14),

 loc varchar2(13),

 constraint pk_dept primary key (deptno)

 )

Insert row into DEPT table using named columns.

insert into DEPT (DEPTNO, DNAME, LOC)

values(10, 'ACCOUNTING', 'NEW YORK')


1 row(s) inserted.

 Statement 4
Insert a row into DEPT table by column position.

insert into dept

values(20, 'RESEARCH', 'DALLAS')


1 row(s) inserted.

 Statement 5
 insert into dept

values(30, 'SALES', 'CHICAGO')


1 row(s) inserted.

 Statement 6
 insert into dept

values(40, 'OPERATIONS', 'BOSTON')


QUERY TO CREATE AND INSERT VALUES IN THE TABLE:
ASSIGNMENT – 5
CREATE TABLE – WORKER AND INSERT FOLLOWING RECORDS

WORKER_ID FIRST_NAME LAST_NAME SALARY JOINING_DATE DEPARTMENT

001 Monika Arora 100000 2014-02-20 09:00:00 HR

002 Niharika Verma 80000 2014-06-11 09:00:00 Admin

003 Vishal Singhal 300000 2014-02-20 09:00:00 HR

004 Amitabh Singh 500000 2014-02-20 09:00:00 Admin

CREATE TABLE – BONUS AND INSERT FOLLOWING RECORDS

WORKER_ID BONUS_DATE BONUS_AMOUNT

1 2016-02-20 00:00:00 5000

2 2016-06-11 00:00:00 3000

3 2016-02-20 00:00:00 4000

1 2016-02-20 00:00:00 4500


 QUERY TO CREATE TABLE AND INSERT RECORDS IN WORKER
TABLE:
 QUERY TO CREATE TABLE AND INSERT RECORDS IN BONUS TABLE:
 Queries performed:

1. Write an SQL query to fetch unique values of DEPARTMENT from Worker


table.

2. Write an SQL query to print all Worker details from the Worker table order
by FIRST_NAME Ascending and DEPARTMENT Descending.

3. Write an SQL query to print details for Workers with the first name as
“Vipul” and “Satish” from Worker table.

4. Write an SQL query to print details of Workers with DEPARTMENT name as


“Admin”.

5. Write an SQL query to print details of the Workers whose FIRST_NAME contains
‘a’.
6. Write an SQL query to print details of the Workers whose FIRST_NAME ends
with ‘h’ and contains six alphabets.

You might also like