IT PROJECT BASED ON SQL - Class 10th CBSE
IT PROJECT BASED ON SQL - Class 10th CBSE
NAINI, PRAYAGRAJ
2024-2025
Project on
Queries in SQL
Signature-
CONTENTS
1. Database Theory
QUERIES TO BE SOLVED
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)
);
```
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;
```
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';
```
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';
```
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';
```