CLASS XC_XE
CLASS XC_XE
INFORMATION TECHNOLOGY
(Subject Code: 402)
QUERIES
NAME :
AISSE ROLL NO :
TABLE OF CONTENTS
1. ACKNOWLEDGEMENT 1
2. INTRODUCTION 2
3. SQL QUERIES 3
4. CONCLUSION 5
ACKNOWLEDGEMENT
I would like to extend my special thanks of gratitude to our Vice Principal Mrs Deepa
Rai Rakali Ma’am for providing me this golden opportunity to work on this project on
Queries and our Subject Teacher Mr P K Das Sir for helping me to complete this project
under his guidance.
NAME:
-1-
INTRODUCTION
In a database we can define the structure of the data and manipulate the data using
some commands. There are two types of languages for this task. They are:
1. DDL (Data Definition Language)
2. DML (Data Manipulation Language)
A query language is a part of DML involving information retrieval only. The terms DML
and query language are often used synonymously.
-2-
SQL QUERIES
1. Create a table EMPLOYEE with the following structure:
INSERT INTO EMPLOYEE VALUES (1001, ‘RAMESH SHARMA’, ‘PGT’, 30000, ‘2020-06-21’);
INSERT INTO EMPLOYEE VALUES (1002, ‘SANTOSH AGARWAL’, ‘TGT’, 25000, ‘2020-06-21’);
INSERT INTO EMPLOYEE VALUES (1003, ‘ANIMESH MUKHERJEE’, ‘PGT’, 30000, ‘2020-06-23’);
INSERT INTO EMPLOYEE VALUES (1004, ‘SANTOSH SINHA, ‘PRT’, 20000, ‘2020-07-02’);
INSERT INTO EMPLOYEE VALUES (1005, ‘JAYANTA RAY’, ‘TGT’, 25000, ‘2020-07-03’);
Output:
EMPNO EMPNAME DESIG BASICPAY JOINDATE
1001 RAMESH SHARMA PGT 30000 2020-06-21
1002 SANTOSH AGARWAL TGT 25000 2020-06-21
1003 ANIMESH MUKHERJEE PGT 30000 2020-06-23
1004 SANTOSH SINHA PRT 20000 2020-07-02
1005 JAYANTA RAY PGT 25000 2020-07-03
4. Display the records from table EMPLOYEE whose DESIG is either ‘PGT or ‘TGT’
Output:
EMPNO EMPNAME DESIG BASICPAY JOINDATE
1001 RAMESH SHARMA PGT 30000 2020-06-21
1002 SANTOSH AGARWAL TGT 25000 2020-06-21
1003 ANIMESH MUKHERJEE PGT 30000 2020-06-23
1005 JAYANTA RAY TGT 25000 2020-07-03
-3-
5. Display the records from table EMPLOYEE whose EMPNAME starts with ‘SANTOSH’
UPDATE EMPLOYEE
SET EMPNAME = ‘JAYANTA KR ROY’
WHERE EMPNAME = ‘JAYANTA RAY’;
Result inside Table:
EMPNO EMPNAME DESIG BASICPAY JOINDATE
1001 RAMESH SHARMA PGT 30000 2020-06-21
1002 SANTOSH AGARWAL TGT 25000 2020-06-21
1003 ANIMESH MUKHERJEE PGT 30000 2020-06-23
1004 SANTOSH SINHA PRT 20000 2020-07-02
1005 JAYANTA KR RAY PGT 25000 2020-07-03
8. Increase the BASICPAY of employees with DESIG ‘PGT’ by 10000 in table EMPLOYEE
UPDATE EMPLOYEE
SET BASICPAY = BASICPAY + 10000
WHERE DESIG = ‘PGT’;
Result inside Table:
EMPNO EMPNAME DESIG BASICPAY JOINDATE
1001 RAMESH SHARMA PGT 40000 2020-06-21
1002 SANTOSH AGARWAL TGT 25000 2020-06-21
1003 ANIMESH MUKHERJEE PGT 40000 2020-06-23
1004 SANTOSH SINHA PRT 20000 2020-07-02
1005 JAYANTA RAY PGT 25000 2020-07-03
9. Remove the record whose EMPNO is 1001 from table EMPLOYEE
DELETE FROM EMPLOYEE WHERE EMPNO = 1003;
Result inside Table:
EMPNO EMPNAME DESIG BASICPAY JOINDATE
1001 RAMESH SHARMA PGT 30000 2020-06-21
1002 SANTOSH AGARWAL TGT 25000 2020-06-21
1004 SANTOSH SINHA PRT 20000 2020-07-02
1005 JAYANTA RAY PGT 25000 2020-07-03
-4-
CONCLUSION
The scope of the SQL commands provide the capability to create a wide variety of
database objects like TABLES, VIEWS etc using the various DDL commands such as
CREATE, ALTER, and DROP commands.
These database objects can then be inserted with data using the DML command
INSERT. The data can be manipulated using a wide variety of other DML commands
such as SELECT, DELETE, and UPDATE.
-5-