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

pdf4

The document outlines a series of lab experiments focused on SQL commands, including creating tables, inserting data, modifying columns, and querying employee records. Each experiment includes specific tasks with placeholders for syntax and examples. The experiments cover various SQL operations such as creating tables, updating records, and displaying data based on conditions.

Uploaded by

Simran Prabhakar
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)
4 views

pdf4

The document outlines a series of lab experiments focused on SQL commands, including creating tables, inserting data, modifying columns, and querying employee records. Each experiment includes specific tasks with placeholders for syntax and examples. The experiments cover various SQL operations such as creating tables, updating records, and displaying data based on conditions.

Uploaded by

Simran Prabhakar
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/ 17

LAB EXPERIMENT -1

1. CREATE COMMAND:
SYNTAX:

EXAMPLE:

2.INSERT COMMMAND:
SYNTAX:

EXAMPLE:
LAB EXPERIMENT-2

1.Create a table EMPLOYEE with following schema: (Emp_no, E_name, E_address, E_ph_no,
Dept_no, Dept_name,Job_id , Salary);
SYNTAX:

EXAMPLE:

2. Add a new column; HIREDATE to the existing relation.


SYNTAX:

EXAMPLE:
3.Change the datatype of JOB_ID from char to varchar.
SYNTAX:

EXAMPLE:

4.Change the name of column/field Emp_no to E_no.


SYNTAX:

EXAMPLE:
5.Modify the column width of the job field of emp table.
SYNTAX:

EXAMPLE:
LAB EXPERIMENT-3

Create a table EMPLOYEE with following schema: (Emp_no, E_name, E_address,


E_ph_no, Dept_no, Dept_name,Job_id , Salary).

1. Insert aleast 5 rows in the table.


SYNTAX:

EXAMPLE:

2. . Display the record of each employee who works in department D10.


SYNTAX:
EXAMPLE:

3. Update the city of Emp_no-2 with current city as Nagpur.

SYNTAX:

EXAMPLE:

4. Display the details of Employee who works in department MECH.


SYNTAX:
EXAMPLE:

5. DELETE the E_address of employee James.

SYNTAX:
DELETE FROM table-name WHERE CONDITION;

EXAMPLE:
6. Display the complete record of employees working in SALES Department.
SYNTAX:

EXAMPLE:
LAB EXPERIMENT -4

1. Display all the dept numbers available with the dept and emp tables avoiding
duplicates.
SYNTAX:

SELECT Dept_no FROM DEPARTMENT


UNION
SELECT Dept_no FROM EMPLOYEE;
EXAMPLE:

2. Display all the dept numbers available with the dept and emp tables.
SYNTAX:

SELECT Dept_no FROM DEPARTMENT

UNION ALL

SELECT Dept_no FROM EMPLOYEE;

EXAMPLE:

3. Display all the dept numbers available in emp and not in dept tables and vice versa.
SYNTAX:

SELECT Dept_no FROM EMPLOYEE

WHERE Dept_no NOT IN (SELECT Dept_no FROM DEPARTMENT)

UNION

SELECT Dept_no FROM DEPARTMENT

WHERE Dept_no NOT IN (SELECT Dept_no FROM EMPLOYEE);

EXAMPLE:
LAB EXPERIMENT-5
Create a table EMPLOYEE with following schema: (Emp_no, E_name, E_address, E_ph_no,
Dept_no, Dept_name,Job_id, Designation , Salary) Write SQL statements for the following
query.

1. List the E_no, E_name, Salary of all employees working for MANAGER.
SYNTAX:
EXAMPLE:

2. Display all the details of the employee whose salary is more than the Sal of any IT
PROFF.
SYNTAX:

EXAMPLE:

3. List the employees in the ascending order of Designations of those joined after 1981.
SYNTAX:
EXAMPLE:

4. List the employees along with their Experience and Daily Salary.
SYNTAX:

EXAMPLE:

5. List the employees who are either ‘CLERK’ or ‘ANALYST’ .


SYNTAX:
EXAMPLE:

6. List the employees who joined on 1-MAY-81, 3-DEC-81, 17-DEC-81,19-JAN-80 .


SYNTAX:

EXAMPLE:

7. List the employees who are working for the Deptno 10 or20.
SYNTAX:

EXAMPLE:
8. List the Enames those are starting with ‘S’ .
SYNTAX:

EXAMPLE:

9. Display the name as well as the first five characters of name(s) starting with ‘H’
SYNTAX:
EXAMPLE:

10. List all the emps except ‘PRESIDENT’ & ‘MGR” in asc order of Salaries.
SYNTAX:

EXAMPLE:

You might also like