0% found this document useful (0 votes)
4 views

IT PROJECT BASED ON SQL - Class 10th CBSE

This document is a project report on SQL queries submitted by Manya Singh for Information Technology class at Maharishi Vidya Mandir. It includes an acknowledgment section, a table structure for employee data, and a series of SQL queries to manipulate and retrieve data from the 'Emp' table. The queries cover creating the table, inserting data, selecting, updating, and deleting records based on specific conditions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

IT PROJECT BASED ON SQL - Class 10th CBSE

This document is a project report on SQL queries submitted by Manya Singh for Information Technology class at Maharishi Vidya Mandir. It includes an acknowledgment section, a table structure for employee data, and a series of SQL queries to manipulate and retrieve data from the 'Emp' table. The queries cover creating the table, inserting data, selecting, updating, and deleting records based on specific conditions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MAHARISHI VIDYA MANDIR

NAINI, PRAYAGRAJ

2024-2025

INFORMATION TECHNOLOGY (402)

Project on

Queries in SQL

Submitted by- Manya Singh


Submitted to- Mrs. Abha ma’am
Class - X ‘A’
Roll No. - 06
ACKNOWLEDGEMENT

I would like to express deep sense of gratitude to our teacher Respected

Abha Ma’am who gave us this excellent opportunity to do this project of

Information Technology (402) on topic “Queries in SQL” and helped me in

completing the project. I came to know about so many things and I am

really thankful to her.

Name- Manya Singh

Signature-

CONTENTS
1. Database Theory

MAHARISHI VIDYA MANDIR, NAINI, PRAYAGRAJ


SESSION 2024- 2025
IT LAB ASSIGNMENT (CLASS X)
Emp Table

Column name Data type Size


Empno Varchar 5(primary key)
Ename Varchar 20
Job Char 10
Hiredate Date
Basic_sal Integer
Comm Integer
Dept_no Varchar 8

Insert the following data into above table:

Empno Ename Job Hire_date Basic_sal Comm


E0001 Gaurav Manager 15-12-2002 5000 500
E0002 Keishn Analyst 24-05-1999 4000 400
E0003 Namit Salesman 10-01-2001 2500 250
E0004 Riya Clark 10-10-2001 3000 300
E0005 Saurabh Admin 11-04-1999 2000 200

QUERIES TO BE SOLVED

1. Create the table Emp on the basis of given fields.


2. Insert the value of given in table.
3. Find out the names of all the employees whose Employee number is E0002 from Emp table.
4. List the names of the employee who have a salary less the Rs. 3000 from Emp table.
5. List the names of the employee who have a commission more then Rs. 250 from Emp table.
6. List the employee name who works as Manager from Emp table.
7. List all managers and salesman with salary over 2500 from Emp table.
8. Display all the employee names in the ascending order of their date of joining from Emp table.
9. Display all the employees in alphabetical order from Emp table.
10. Write a command to update the salary of the emp to 8000 whose job is manager.
11. List all the data of table Emp.
12. Write a query to delete Admin who have employee no E0005 in table Emp.
13. Delete all records from Emp table.
14. Add a column “Telephone _No” of data type “number” and size=’10’ to the Emp table.
15. Change the job of Empno ‘E0004’ from ‘Clark’ to ‘Salesman’ from Emp table.

Solutions-
1. Create the table Emp on the basis of given fields.
```sql
CREATE TABLE Emp (
Empno VARCHAR(5) PRIMARY KEY,
Ename VARCHAR(20),
Job CHAR(10),
Hiredate DATE,
Basic_sal INTEGER,
Comm INTEGER,
Dept_no VARCHAR(8)
);
```

2. Insert the value of given data in the table.


```sql
INSERT INTO Emp VALUES
('E0001', 'Gaurav', 'Manager', '2002-12-15', 5000, 500, NULL),
('E0002', 'Keishn', 'Analyst', '1999-05-24', 4000, 400, NULL),
('E0003', 'Namit', 'Salesman', '2001-01-10', 2500, 250, NULL),
('E0004', 'Riya', 'Clark', '2001-10-10', 3000, 300, NULL),
('E0005', 'Saurabh', 'Admin', '1999-04-11', 2000, 200, NULL);
```

3. Find out the names of all the employees whose Employee number is E0002 from Emp table.
```sql
SELECT Ename FROM Emp WHERE Empno = 'E0002';
```

4. List the names of the employees who have a salary less than Rs. 3000 from Emp table.
```sql
SELECT Ename FROM Emp WHERE Basic_sal < 3000;
```

5. List the names of the employees who have a commission more than Rs. 250 from Emp table.
```sql
SELECT Ename FROM Emp WHERE Comm > 250;
```

6. List the employee name who works as Manager from Emp table.
```sql
SELECT Ename FROM Emp WHERE Job = 'Manager';
```

7. List all managers and salesmen with salary over 2500 from Emp table.
```sql
SELECT Ename FROM Emp WHERE (Job = 'Manager' OR Job = 'Salesman') AND Basic_sal > 2500;
```

8. Display all the employee names in the ascending order of their date of joining from Emp table.
```sql
SELECT Ename FROM Emp ORDER BY Hiredate ASC;
```

9. Display all the employees in alphabetical order from Emp table.


```sql
SELECT * FROM Emp ORDER BY Ename ASC;
```

10. Write a command to update the salary of the emp to 8000 whose job is Manager.
```sql
UPDATE Emp SET Basic_sal = 8000 WHERE Job = 'Manager';
```

11. List all the data of table Emp.


```sql
SELECT * FROM Emp;
```

12. Write a query to delete Admin who has employee no E0005 in table Emp.
```sql
DELETE FROM Emp WHERE Empno = 'E0005' AND Job = 'Admin';
```

13. Delete all records from Emp table.


```sql
DELETE FROM Emp;
```

14. Add a column “Telephone_No” of data type “number” and size=10 to the Emp table.
```sql
Alter EMP Add telephone _no int(10);
```

15. Change the job of Empno ‘E0004’ from ‘Clark’ to ‘Salesman’ from Emp table.
```sql
UPDATE Emp SET Job = 'Salesman' WHERE Empno = 'E0004';
```

You might also like