Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Lab mst worksheet


Name: Prashant kumar singh UID:21BCS2008
Branch: CSE Section/Group: 701 A
Semester: 3rd Subject Code: 21CSH-214
Subject Name: DBMS

Software Used:
Oracle application express

Hardware requirements:
Processor = intel CORE i5 11th gen
RAM= 8.00 GB
SSD= 512 GB
Keyboard and Mouse.

Question 1:
1. Create table Employee having following rows

Empid EmpName Permanent ContactNo EmailId salary


101 Isha no 1234567890 isha@gmail.com 2000
102 Priya yes 1234567890 priya@yahoo.com 10000
103 Neha yes 1234567890 neha@gmail.com 5000
104 Rahul no 1234567890 rahul@yahoo.com 1900
105 Abhishek no 1234567890 abhishek@gmail.com 2300

Code:
create table Employee (Empid number(10) primary key,
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

EmpName varchar2(30),

Permanent varchar2(10),

ContactNo number(20),

EmailId varchar2(255),

salary number(10));

insert into Employee(


Empid,
EmpName,
Permanent,
ContactNo,
EmailId,
salary) values (101,
'Isha',
'no',
1234567890,
'isha@gmail.com',
2000);

insert into Employee(


Empid,
EmpName,
Permanent,
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

ContactNo,
EmailId,
salary) values (102,
'Priya',
'yes',
1234567890,
'priya@yahoo.com',
10000);

insert into Employee(


Empid,
EmpName,
Permanent,
ContactNo,
EmailId,
salary) values (103,
'Neha',
'yes',
1234567890,
'neha@gmail.com',
5000);

insert into Employee(


Empid,
EmpName,
Permanent,
ContactNo,
EmailId,
salary) values (104,
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

'Rahul',
'no',
1234567890,
'rahul@yahoo.com',
1900);

insert into Employee(


Empid,
EmpName,
Permanent,
ContactNo,
EmailId,
salary) values (105,
'Abhishek',
'no',
1234567890,
'abhishek@gmail.com',
2300);
select * from Employee;
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Output:
EMPID EMPNAME PERMANENT CONTACTNO EMAILID SALARY

102 Priya yes 1234567890 priya@yahoo.com 10000


103 Neha yes 1234567890 neha@gmail.com 5000
104 Rahul no 1234567890 rahul@yahoo.com 1900
105 Abhishek no 1234567890 abhishek@gmail.com 2300
101 Isha no 1234567890 isha@gmail.com 2000
5 rows returned in 0.05
Download
seconds

2. Select the detail of the employee whose name start with P.

Code:
select * from Employee where Empname like 'P%';
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Output:
EMPID EMPNAME PERMANENT CONTACTNO EMAILID SALARY

102 Priya yes 1234567890 priya@yahoo.com 10000


1 rows returned in 0.07
Download
seconds
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

3. How many permanent employees take salary more than 5000.


CODE:
Select count(Empid) from Employee where Permanent ='yes' and salary>5000;
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

OUTPUT:

COUNT(EMPID)

1
1 rows returned in 0.01 Downloa
seconds d

4. Select the detail of employee whose emailId is in gmail.

CODE:

select * from Employee where Emailid like '%gmail%';


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

OUTPUT:

EMPID EMPNAME PERMANENT CONTACTNO EMAILID SALARY

103 Neha yes 1234567890 neha@gmail.com 5000


105 Abhishek no 1234567890 abhishek@gmail.com 2300
101 Isha no 1234567890 isha@gmail.com 2000
3 rows returned in 0.01
Download
seconds
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

5. What is total salary that is paid to permanent employees.

CODE:

select sum(salary) from Employee where Permanent ='yes';

OUTPUT:

SUM(SALARY)

15000
1 rows returned in 0.01 Downloa
seconds d
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Question 2:. Differentiate between SQL and PLSQL


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Learning outcomes (What I have learnt):


1. Came to know about the basics of SQL.
2. Learnt about the concept of creation of table.
3. Implemented a program on insertion.
4. Implemented the program of select command with where clause.

You might also like