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

Program List Dbms (1)

The document outlines a comprehensive program list for SQL, PL/SQL, and MongoDB tasks, including creating and manipulating tables, executing various SQL statements, and performing CRUD operations in NoSQL. It covers multiple exercises involving data retrieval, aggregation, and constraints, as well as PL/SQL programming for mathematical operations. Additionally, it includes tasks for designing databases and managing data in MongoDB, emphasizing practical applications in database management.

Uploaded by

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

Program List Dbms (1)

The document outlines a comprehensive program list for SQL, PL/SQL, and MongoDB tasks, including creating and manipulating tables, executing various SQL statements, and performing CRUD operations in NoSQL. It covers multiple exercises involving data retrieval, aggregation, and constraints, as well as PL/SQL programming for mathematical operations. Additionally, it includes tasks for designing databases and managing data in MongoDB, emphasizing practical applications in database management.

Uploaded by

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

PROGRAM LIST

SQL
1. Execute DDL statements
I. Create a table Student with fields (RollNo, Name, Course, Year).
II. Alter table.
III. Drop table.
IV. Truncate table.
Write necessary query statements.
2. Execute DML statements
I. Create table Employee (EmployeeId, Name, Department, salary)
Also create another table Department (DepartmentId, DeptName,
HeadOfDepartment)
II. Insert a minimum of 5 rows.
III. Set Primary Key and Foreign Key constraints.
IV. Display the records.
V. Update a record.
VI. Delete a record.
3. Create a table and execute DCL statements (grant, revoke).
4. Create a table and execute TCL statements (commit, rollback, savepoint).
5. Consider the CUSTOMERS table having the following records
ID NAME AGE HOME- SALARY
TOWN
1 Ramesh 32 Ahmedabad 2000.00

2 Khilan 25 Delhi 1500.00

4 kaushik 23 Kota 2000.00


4 Chaitali 25 Mumbai
6500.00
5 Hardik 27 Bhopal
8500.00
6 Komal 22 MP
4500.00
7 Muffy 24 Indore
10000.00
8 Ramu 23 Delhi 6000.00

9 Rohit 24 Ahmedabad
5000.00
10 Shamli 23 Mumbai
10000.00

I. Display details of Customers whose ID is 4. (Simple select)


II. Display distinct hometowns of customers. (DISTINCT)
III. Display the total number of Salary of customers. (COUNT)

6. Consider we have an employee table created in the database with the following data:
ID First_Name Last_Name Department Location Salary
1 Harshad Kuwar Marketing Pune 10000
2 Anurag Rajput IT Mumbai 20000
3 Chaitali Tarle IT Chennai 30000
4 Pranjal Patil IT Chennai 25000
5 Suraj Tripathi Marketing Pune 15000
6 Roshni Jadhav Finance Bangalore 20000
7 Sandhya Jain Finance Bangalore 20000

I. Display details of employees from employee tables in which the department of the
employee is IT and the location is Chennai. (Where, And)

II. Display details of employees from employee tables in which the department of the
employee is IT or the location is Chennai. (Where, OR)

III. Display First_Name and Location number under the temporary column names 'EMP
FN' and ‘Address’, respectively. (AS)

IV. List records of employees whose names start with “S”.(Like)


V. Add the salary of employees for each city. (Groupby)
VI. Show that Location whose total salary of employees is more than 10000. (Having)
VII. Sort the records in the ascending order of the Employee names stored in the employee
table.(Orderby)
7.Aggregate functions
StudentID StudentName Marks
1 Sanjay 64
2 Varun 72
3 Akash 45
4 Rohit 86
5 Anjali 92
6 Ammu 95
7 Rahul 80
8 Prathibha 62
9 Ravi 75
10 Pulkit 76

I. Write a query to count the number of students scoring marks > 75 from the Students
table.
II. Write a query to calculate the average marks of all students from the Students table.
III. Write a query to retrieve the minimum marks out of all students from the Students
table.
IV. Write a query to retrieve the maximum marks out of all students from the Students
table.
8. Subquery
Tables to be used:
Sailors (sid: integer, sname: string, rating: integer, age: real)
Boats (bid: integer, bname: string, color: string)
Reserves (sid: integer, bid: integer,day: date)

sailors
sid sname rating age
22 Dustin 7 45.0
29 Brutus 1 33.0
31 Lubber 8 55.5
32 Andy 8 25.5
58 Rusty 10 35.0
64 Horatio 7 35.0
71 Zorba 10 16.0
74 Horatio 9 35.0
85 Art 3 25.5
95 Bob 3 63.5

reserves
sid bid day
22 101 10/10/98
22 102 10/10/98
22 103 10/8/98
22 104 10/7/98
31 102 11/10/98
31 103 11/6/98
31 104 11/12/98
64 101 9/5/98
64 102 9/8/98
74 103 9/8/98

boats
bid bname color
101 Interlake blue
102 Interlake red
103 Clipper green
104 Marine red

Create the tables.


I. Insert data.
II. Find distinct names of sailors.
III. Find all information on sailors who have reserved boat number 101.
IV. Find names of sailors who have reserved at least one boat.
V. Find names of sailors who have reserved a red boat and list them in the order of
their age.
VI. Find the ids and names of sailors who have reserved two different boats on the
same day.
9. Union, Intersect and Except
Using the same table
I. Find the ids of sailors who have reserved a red boat or a green boat.
II. Find the names of sailors who have reserved boat 103.
III. Find the name and the age of the youngest sailor.
IV. Find the names of sailors who have reserved all boats.
10. Aggregation Operators
Using the same table
I. Find the name and the age of the youngest sailor.
II. Find the average age of sailors for each rating level.
III. Count the number of different sailor names.
IV. Calculate the average age of all sailors.
PL/SQL
11. Write a PL/SQL program to add two numbers.
12. Write a PL/SQL program to check whether a number is odd or even.
13. Write a PL/SQL program to find the factorial of a number.
14. Write a PL/SQL program to find the greatest of 3 numbers.
15. Write a PL/SQL procedure to find the maximum of two values.
16. Write a PL/SQL procedure to compute square of a given value.
17. Execution of trigger.
18. Execution of cursor.

MongoDB
19. Designing Databases using NoSQL
I. Create database Employee and Make Collection With name "EMPL" (Empno,
Name, Salary, role).
II. Insert Records Into EMPL Collection(10 records).
III. Display Data in Proper Format.
20. Designing Databases using NoSQL
I. Create a database movie and make a collection with the name
“MovieDetails”(Title, Writer, Year, Actor).
II. Insert Records Into the MovieDetails Collection(10 records).
III. Display Data in Proper Format.
21. Performing CRUD operations
Use Employee database
i.
Find a Document From the EMPL collection where the name begins with S.
ii.
Find a Document From the EMPL collection where the name ends with K.
iii.
Find a Document From the EMPL collection where the name has S in any
position.
iv. Update Salary Of Employee where Name is "ST" by +8000.
v. Update the Salary Of All Employees by giving an increment of +4000 each.
vi. Add a New Field remark to the document with the name "RS" set Remark as
WC.
22. Program to create users and roles.

[
{
"name":"Krish","age":35,"gender":"M","exp":10,
"subjects":[
"DS",
"C",
"OS"
],
"type":"Full Time","qualification":"M.Tech"
},
{
"name":"Manoj","age":38,"gender":"M","exp":12,
"subjects":[
"JAVA",
"DBMS"
],
"type":"Full Time", "qualification":"Ph.D"
},
{
"name":"Anush","age":32,"gender":"F","exp":8,
"subjects":[
"C",
"CPP"
],
"type":"Part Time","qualification":"M.Tech"
},
{
"name":"Suresh","age":40,"gender":"M","exp":9,
"subjects":[
"JAVA",
"DBMS",
"NETWORKING"
],
"type":"Full Time", "qualification":"Ph.D"
},
{
"name":"Rajesh","age":35,"gender":"M","exp":7,
"subjects":[
"DS",
"C",
"OS"
],
"type":"Full Time","qualification":"M.Tech"
},
{
"name":"Mani","age":38,"gender":"F","exp":10,
"subjects":[
"JAVA",
"DBMS",
"OS"
],
"type":"Part Time", "qualification":"Ph.D"
},
{
"name":"Sivani","age":32,"gender":"F","exp":8,
"subjects":[
"C",
"CPP",
"MATHS"
],
"type":"Part Time","qualification":"M.Tech"
},
{
"name":"Nagesh","age":39,"gender":"M","exp":11,
"subjects":[
"JAVA",
"DBMS",
"NETWORKING"
],
"type":"Full Time", "qualification":"Ph.D"
},
{
"name":"Nagesh","age":35,"gender":"M","exp":9,
"subjects":[
"JAVA",
".Net",
"NETWORKING"
],
"type":"Full Time", "qualification":"Ph.D"
},
{
"name":"Latha","age":40,"gender":"F","exp":13,
"subjects":[
"MATHS"
],
"type":"Full Time", "qualification":"Ph.D"
}
]
I. Get the details of all the faculty.
II. Get the count of all faculty members.
III. Get all the faculty members whose qualification is “Ph.D”.
IV. Get all the faculty members whose experience is between 8 to 12 years.
V. Get all the faculty members who teach “MATHS” or “NETWORKING”.
VI. Get all the faculty members who teach “MATHS” whose age is more than 30
years and whose qualification must be “Ph.D.”.
VII. Get all the faculty members who are working part-time or who teach “JAVA”.
VIII. Delete all faculty members whose age is more than 55 years.
IX. Get the name, qualification and exp of all faculty members and display the same
in ascending order of exp.
X. Sort the faculty details by their age (descending order) and get the details of the
first five faculty members only.

You might also like