0% found this document useful (0 votes)
2 views4 pages

Gurvinder Dbms 1st Evaluation

Uploaded by

Gurvinder Aulakh
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)
2 views4 pages

Gurvinder Dbms 1st Evaluation

Uploaded by

Gurvinder Aulakh
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

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

WORKSHEET 1.1

Student Name: Gurvinder Singh UID: 22BCS13149


Branch: CSE Section/Group: 817-B
Semester: 4th Date of Performance: 07/02/24
Subject Name: DBMS Subject Code: 22CSH-254

1. Aim:
Q1: a) Write a code to display the details of employee in alphabetical order.
b) Write a code to display the record of employee whose salary is between 30000 to 50000.
Q2: a) Write a code to change the salary of employee of those in Employee table having
employee code 1009 to 55000.
b) Write a code to update the salary to 58000 and grade to B2 for those employee whose
employee code is 102.

2. Source Code:
Q1:(a)
Create Table Employee(
Ecode NUMBER,
Ename VARCHAR2(20),
Gender VARCHAR2(1),
Grade VARCHAR2(20),
Gross NUMBER
);
INSERT INTO Employee (Ecode, Ename, Gender, Grade, Gross)
VALUES (102, 'Devansh', 'M', 'A', 39000),
(104, 'Gurvinder', 'M', 'B', 38950),
(109, 'Kafi', 'F', 'C', 40000),
(101, 'Rahul', 'M', 'A', 53000),
(106, 'Saniya', 'F', 'B', 48000);

SELECT * FROM Employee


ORDER By Ename ASC;
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Q1:(b)
Create Table Employee(
Ecode NUMBER,
Ename VARCHAR2(20),
Gender VARCHAR2(1),
Grade VARCHAR2(20),
Gross NUMBER
);
INSERT INTO Employee (Ecode, Ename, Gender, Grade, Gross)
VALUES (102, 'Devansh', 'M', 'A', 39000),
(104, 'Gurvinder', 'M', 'B', 38950),
(109, 'Kafi', 'F', 'C', 40000),
(101, 'Rahul', 'M', 'A', 53000),
(106, 'Saniya', 'F', 'B', 48000);

SELECT * FROM Employee


WHERE Gross BETWEEN (SELECT 30000) AND 50000;

Q2:(a)
Create Table Employee(
Ecode NUMBER,
Ename VARCHAR2(20),
Gender VARCHAR2(1),
Grade VARCHAR2(20),
Gross NUMBER
);
INSERT INTO Employee (Ecode, Ename, Gender, Grade, Gross)
VALUES (102, 'Devansh', 'M', 'A', 39000),
(1004, 'Gurvinder', 'M', 'B', 38950),
(10409, 'Kafi', 'F', 'C', 40000),
(10001, 'Rahul', 'M', 'A', 53000),
(10206, 'Saniya', 'F', 'B', 48000);
SELECT * FROM Employee
WHERE Ecode BETWEEN (SELECT 1009) AND 55000;
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Q2: (b)
Create Table Employee(
Ecode NUMBER,
Ename VARCHAR2(20),
Gender VARCHAR2(1),
Grade VARCHAR2(20),
Gross NUMBER
);
INSERT INTO Employee (Ecode, Ename, Gender, Grade, Gross)
VALUES (102, 'Devansh', 'M', 'A', 39000),
(1004, 'Gurvinder', 'M', 'B', 38950),
(10409, 'Kafi', 'F', 'C', 40000),
(10001, 'Rahul', 'M', 'A', 53000),
(10206, 'Saniya', 'F', 'B', 48000);

UPDATE Employee
SET Grade = 'B'
WHERE Ecode = 102;

3. Screenshot of Outputs:
Q1:(a)

Q1:(b)
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Q2. a)

Q2. b)

4. Learning Outcomes:
 Learnt how to create tables and insert data in SQL.
 Learnt how to retrieve and sort data using the `SELECT` and `ORDER BY`
statements.
 Learnt how to filter data with the `WHERE` clause, understanding conditional
queries.
 Learnt how to create and modify tables.
 Learnt the use of `SELECT` statement.

You might also like