Professional Documents
Culture Documents
Navrachana University
School of Engineering and Technology
Department of Information Technology
Semester – III
Year: 2020-2021
Index
Performance Submission
Sr. No. Lab Exercise Marks
Date Date
1 Lab Exercise 1 28/07/20 10/08/20
2 Lab Exercise 2 29/07/20 10/08/20
3 Lab Exercise 3 04/08/20 10/08/20
4 Lab Exercise 4 05/08/20 10/08/20
5 Lab Exercise 5 18/08/20 10/08/20
6 Lab Exercise 6 (25,26)/08/20 10/08/20
7 Lab Exercise 7 01/09/20 10/08/20
8 Lab Exercise 8 02/09/20 10/08/20
9 Lab Exercise 9 08/09/20 10/08/20
10 Lab Exercise 10 08/09/20 10/08/20
LAB-TASK-1(RDBMS)
NAME:VEER SHAH
B.TECH-S.Y-IT
ID-19125052
• Consider the following schema
1. Display the column names, data type and size and of table Employee.
2. Display the column names, data type and size and of table Dept.
3. Add a new column ‘City’ into Employee table with varchar2 datatype and size 10.
4. Update the size of salary attribute to ‘5’.
7. The employee who working in department No. 20 and whose employee id is 102
now shifted to ‘Surat’ city.
8. Increase the salary of employees by 1000 if his/her salary is greater than 12000 or equal to
and increase it by 500 if its less than 12000.
LAB-TASK-2(RDBMS)
NAME:VEER SHAH
B.TECH-S.Y-IT
ID-19125052
5. Display the book id and book name of books whose Author is ‘Abugov’.
6. Display the details of books whose 10 or more copies are available in the database.
7. Display the Name of books which are available for subject code ‘IT216’.
9. Display the name of books whose book name ends with character ‘s’
10. Modify the price of books as given bellow:
a. Increase 50 rupees whose price < 400,
12. Display a book whose less than 6 copies are there in database.
14. Display book detail whose author name starts with letter A.
15. Change the name of author of book”intodruction to SQL ” from Nawathe to Kurth.
16. Change the number of copies from 10 to 20.
• Emp
Eid Ename Job Salary DNo
101 Nisha IT Head 60000 10
102 Meet Salesman 15000 20
103 Aaisha HR 30000 30
104 Keshav s/w Developer 35000 10
105 Leena S/w Tester 32000 10
106 Mehul Sales Executive 25000 20
3. Calculate the average salary of employees who are working in department no. 20
and 30.
8. Find maximum salary drawn by the employees from department number 10 and
20.
10. Add the commission as 5000 rupees whose salary is less than or equal to 30000
or greater than 20000 and add commission as 2500 whose salary is less
than or equal to 20000.
11. Find total number of employees who get some commission.
12. Find the total number of employees works in department No. 20.
13. Display the total number of employees who gets the commission more than
3500.
14. Display the average salary of each department in descending order
15. Display the total number of employees whose salary is greater than average
salary of all employees.
LAB 4-TASK 1(RDBMS)
NAME:VEER SHAH
B.TECH-S.Y-IT
ID-19125052
6. Find the sum of Amount of each individual customer and groups the result using
customer name.
Ans:
10. Find the minimum value order from the table Orders:
Ans:
LAB 4-TASK 2(RDBMS)
NAME:VEER SHAH
B.TECH-S.Y-IT
ID-19125052
1. Write a SQL statement to find the total purchase amount of all orders.
Ans:
2. Write a SQL statement to find the average purchase amount of all orders.
Ans:
3. Write a SQL statement to get the maximum purchase amount of all the orders.
Ans:
4. Write a SQL statement to get the minimum purchase amount of all the orders.
Ans:
5. Write a SQL statement to find the highest purchase amount ordered by the
each customer with their ID and highest purchase amount.
Ans:
6. Write a SQL statement to find the highest purchase amount ordered by the each
customer on a particular date with their ID, order date and highest purchase
amount.
Ans:
7. Write a SQL statement to find the highest purchase amount on a date '2012-08-17' for
each salesman with their ID.
Ans:
8. Write a SQL statement to find the highest purchase amount with their ID and order
date, for only those customers who have highest purchase amount in a day is more
than 2000.
Ans:
9. Write a SQL statement to find the highest purchase amount with their ID, for only
those customers whose ID is within the range 3002 and 3007.
Ans:
LAB-5(RDBMS)
NAME:VEER SHAH
B.TECH-S.Y-IT
ID-19125052
Part 1
Q1 Create the tables as per above schema and set the different keys as per requirement
Q2 Insert 5 records in each table.
Q3 List the titles of all movies directed by ‘Subhash Ghai’
Q4 Display the name of all actors whose name starts with ‘D’.
Q5 Find the movie names where one or more actors acted in two or more movies.
Q8 Display the details of all female Actors whose Name have the second last letter ‘y’;
Q10 Display the name of all actors who have done role of ‘Politician’;
Part 2
LOC VARCHAR2(10)
EMP
EMPNO NUMBER (4) PRIMARY KEY PK_EMP
JOB VARCHAR2(10)
HIREDATE DATE
Q3 Insert only the records of employee number, name, and salary into EMP table.
Q4 Update the salary by 10% hike to analysts working in department number 20 & 30.
Q5 Give all the employees a commission of Rs 500
Q6 Modify the column ENAME present in the EMP table with the following information
given below: CHAR(20)
Q7 Add two columns to the table EMP with the following information in one single
ALTERCOMMAND.[(Gender varchar2 with size 1), (Place varchar2 with size 10)].
Q8 Add new column as company_name to DEPT table and assign default value as ‘Reliance’ to
the new records
Q9 Add a new column PINCODE with not null constraints to the existing table DEPT
Q10 Disable the constraints PK_DEPTNO present in the DEPT table.
LAB-6(RDBMS)
NAME: VEER SHAH
B.TECH-S.Y-IT
ID-19125052
• Consider the schema for University Database:
1. Consider the above database and draw the Entity Relationship Model.
2. Draw the schema diagram for the above database.
III. Create a view of Test1 marks of student USN ‘1AIT101’ in all subjects.
V. Give these details only for 8th semester A, B, and C section students.
Task - 2 (26-8-2020)
1. Give University student number and Student Name of the students who are in
semester -4.
4. Give the details of the subject whose title starts with ‘D’and ends with ‘M’.
5. Find out the details of student who got highest and lowest marks in Final
internal assessment from all semester
6. Get the details of student who have secured less than average marks of
students in Test 2.
7. Find out Maximum and minimum marks of student semester wise in Test 3.
8. Get the student name of those students who got third highest marks in
Semester 6 and section ‘B’.
9. Get the subject details whose credits are 3 or more.
Q1 Write a query to fetch the EmpFname from the EmployeeInfo table whose salary is equal
to average salary.
Q2 Write a query to fetch the number of employees working in the department ‘HR’.
Q3 Write a query to retrieve the first four characters of EmpLname from the Employee Info table.
Q4 Write a query to find all the employees whose salary is between 50000 to 100000.
Q5 Write a query to find the names of employees that begin with ‘S’ and have 4th
character as ‘A’.
Q6 Write a query to retrieve the EmpFname and EmpLname in a single column as
“FullName”. The first name and the last name must be separated with space.
Q7 Write a query to fetch all the records from the EmployeeInfo table ordered by
EmpLname in descending order and Department in the ascending order.
Q8 Write a query to fetch details of employees whose EmpLname ends with an alphabet
‘A’ and contains five alphabets.
Q9 Write a query to fetch details of all employees excluding the employees with first
names, “Sanjay” and “Sonia” from the EmployeeInfo table.
Q10 Write a query to fetch details of employees with the address as “DELHI”.
Q11 Write a query to display the first and the last record from the EmployeeInfo table.
Q12 Write an SQL query to fetch the count of employees working in project ‘P1’.
Q13 Write an SQL queries to fetch those employees who live in Toronto and working under
project P1.
Q14 Write an SQL query to find the employee id whose salary lies in the range of 9000 and
15000.
Q15 Write an SQL queries to fetch all the employees who either live in California or
working under project P1.
LAB-TASK-8(RDBMS)
NAME:VEER SHAH
B.TECH-S.Y-IT
ID-19125054
• CEIL = function is used to get the smallest integer which is greater than, or
equal to, the specified numeric expression
.
• FLOOR = function returns the largest integer value that is smaller than or
equal to a number
• The POWER function returns the value of a number raised to the power of
another number.
• The ROUND function rounds a number to a specified number of
decimal places. Tip: Also look at the FLOOR and CEILING functions.
• The LOG function returns the natural logarithm of a specified number, or the
logarithm of the number to the specified base
.
LAB-TASK-10
NAME:VEER SHAH
B.TECH-S.Y-IT
ID-19125052
Q5 Write a SQL query to find the position of the alphabet (‘a’) in the first name column ‘Amitabh’
from Worker table.
Q6 Write a SQL query to print details for Workers with the first name as “Vipul” and “Satish” from
Worker table.
Q7 Write a SQL query to print details of the Workers who have joined in Feb’2014.
Q8 Write a SQL query to fetch worker names with salaries >= 50000 and <= 100000.
Q9 Write a SQL query to show the second highest salary from a table.
Q10 Write a SQL query to fetch the first 50% records from a table.
Q11 Write a SQL query to print the name of employees having the highest salary in each
department.
Q12 Write a SQL query to fetch three max salaries from a table.
Q13 Write a SQL query to fetch three min salaries from a table.
Q14 Write a SQL query to fetch departments along with the total salaries paid for each of them.
Q15 Write a SQL query to fetch the names of workers who earn the highest salary.
Create a table with attributes- ord_no ,customer name, purch_amt ,ord_date, customer_id ,
salesman_id.
1. Write a SQL statement to find the total purchase amount of all orders.
2. Write a SQL statement to find the average purchase amount of all orders.
3. Write a SQL statement to get the maximum purchase amount of all the orders.
4. Write a SQL statement to get the minimum purchase amount of all the orders
5. Write a SQL statement to find the highest purchase amount ordered by the each customer with their
ID and highest purchase amount.
6. Write a SQL statement to find the highest purchase amount ordered by the each customer on a
particular date with their ID, order date and highest purchase amount.
7. Write a SQL statement to find the highest purchase amount on a date '2012-08- 17' for each salesman
with their ID.
8. Write a SQL statement to find the highest purchase amount with their ID, for only those customers
whose ID is within the range 3002 and 3007.
10.How many characters does the customer name: “AMIT” have in the table
11. Display output of order_no field as PRODUCT_No in table.
13. Add a column: Product to the existing table with data type varchar and size 20
14.Write a query to extract the customer name, customer_id from the table where the
purchase_amount are greater than 50,000.
Create an inter University Database with the following relations. Include at least four attributes for
each table. Also draw ER diagram for the same.
a) Create above tables and mention primary keys and foreign keys.
b) Insert at least 5 relevant records in each of the created tables.