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

Journal

The document outlines a laboratory manual containing SQL queries to perform various data definition language (DDL) and data manipulation language (DML) commands like creating tables, inserting, updating, and deleting records. It also includes queries using aggregation functions, joins, and various operators. The final sections cover modifying tables using ALTER and DROP commands.

Uploaded by

sksinghirbn0
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Journal

The document outlines a laboratory manual containing SQL queries to perform various data definition language (DDL) and data manipulation language (DML) commands like creating tables, inserting, updating, and deleting records. It also includes queries using aggregation functions, joins, and various operators. The final sections cover modifying tables using ALTER and DROP commands.

Uploaded by

sksinghirbn0
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Laboratory Manual

1. Execute a SQL queries to perform various DDL Commands.


(Create minimum 2 tables with different data types and operate upon them).
Table employee (emp_id, emp_name, city, dept, salary).
Table customer (Cust_ID, Cust_name, Cust_phno, Cust_Add, city, country)

2. Implement SQL queries to perform various DML Commands. (Insert minimum 5 rows
using different insert methods, edit and remove data using update and delete commands).
Perform following queries for above table.
1) Insert five records in employee table.
2) Update employee’s salary to 20000 for all employees working in marketing
department.
3) Delete all employees working in finance department.

3. Retrieve data using SELECT command.


Perform following queries for employee table.
1) Find out all employees living in Vadodara city.
2) Find out all employees working in marketing department.

4. Implement SQL queries using group functions like Avg, Min, Max, Sum and Count etc.
Create table employee with fields (emp_id, emp_name, city, dept, salary)
1) Count total numbers of employees living in Vadodara city.
2) Find out minimum salary of employee.
3) Find out maximum salary of employee.
4) Find out the sum of salary of employees working in marketing department.
5) Find out average of salary of all employees.

5. Retrieve data using SELECT Command and various SQL operations.


1) table customer (Cust_ID, Cust_name, city, country, ph_no).
2) table Student_deatil (stud_id, stud_name, city, percentage, semester, age)
1) Find out all customers from the country “India” and the city “Gujarat” using AND
operator.
2) Find out all customers from the city “Surat” or “Vadodara” usind OR operator.
3) Find out all employees from the city ‘Vadodara’ and department is ‘Marketing’
using AND Operator.
4) Find out all students who have first class (percentage between 60 to 69) using
BETWEEN operators.
5) Find the names of the students between the age 10 to 15 years using >= and <=
operator.
6) Find out list of employees who have salary more than 5000 using > operator.
6. Write a SQL to find Customers living in ‘Mumbai’, ‘Ahmadabad’ and ‘Vadodara’ using
IN Operator.

7. Write a SQL to find Customers not living in ‘Mumbai’, ‘Ahmadabad’ and ‘Vadodara’
using In Operator.

8. Write a SQL for a particular table and dos various operations on it.
Table Customer (CustomerID, CustomerName, Country, Address)
Perform following constraints
1) CustomerID is primary key.
2) CustomerID should start with ‘C’ e.g. C001, C002…..
3) Customer Name should not be Null.

9. Write a SQL for a particular table and dos various operations on it.
Table student_master(stud_id, stud_name,city, semester, age)
1) Write a SQL to find all students with a City starting with letter “s”.
2) Write a SQL to find out list of students having age less than 23.
3) Write a SQL to find list of students with name ending with the letter “a”.
4) Write a SQL to find students whose second character is ‘a’.

10. Write a SQL to display all customers from the “customer” table, sorted by the “City”
column also try to sort in descending order.

11. Write a SQL statement selects all customers from the city “Mumbai” OR “Ahmedabad”,
in the “customers” table.

12. Write a SQL to create table Sales with fields (O_id, Oder_name, P revious_balance,
Customer). And find all the customers whose Pervious_balance is more than 5000.

13. Create following tables.


1. Person (P_ID, LastName, FirstName, Address, City)
2. Orders (Order_ID, Order_No, and P_ID)
1) Make P_ID as Primary key in Person table.
2) Make Order_ID as Primary key and Order_ID As Foreign key.
14. Create two tables Customer(Cust_ID, Cust_name, city, Address, ContactName) and
table Orders (Order_ID, Cust_ID, shipper_ID, Order_Date).
Perform Inner joins on tables Customer and Orders.

15. Perform left join on above both tables Customer and Orders.

16. Create one table employee (empid, empname, salary, designation) also Create sequence
and use it to insert records.
17. Create a SQL to create two tables First with two fields ID, Name and second tables with
same fields ID, Name and perform Union set Operation on it.

18. Create a SQL to perform Intersect set operation on above two tables.

19. Create a SQL to perform minus set operation on above two tables.

20. Create a table name students with column stud_id, stud_name, det, semester, and city
perform following queries.
1) Make stud_id as primary key and insert seven records.
2) Find the students who are living in Baroda city and studying in ‘IMCA’ department.
3) Find all the students whose name is start with ‘A’.

21. Writa SQL to show the user of ALTER and DROP command to modify table.
Table employee (EMP_id, EMP_name, Salary).
1) Add new column to above table.
2) Change column data type
3) Drop table column.

You might also like