Program List Dbms (1)
Program List Dbms (1)
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
9 Rohit 24 Ahmedabad
5000.00
10 Shamli 23 Mumbai
10000.00
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)
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
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.