0% found this document useful (0 votes)
48 views9 pages

2024-2025 Dbms External Paper

Uploaded by

nish630174
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views9 pages

2024-2025 Dbms External Paper

Uploaded by

nish630174
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

CMR INSTITUTE OF TECHNOLOGY : : HYDERABAD

UGC AUTONOMOUS

II–B.Tech.–III–Semester

Database Management System

Lab External Examination 30thJan’ 2024

1. Create a table EMPLOYEE with following schema:


(Emp_no, E_name, E_address, E_ph_no, Dept_no, Dept_name, Job_id, Salary)
a. Add a new column; HIREDATE to the existing relation.
b. Change the datatype of JOB_ID from char to varchar2.
c. Change the name of column/field Emp_no to E_no.
d. Modify the column width of the job field of emp table.
e. Write the differences between nested query and correlated nested query with an example

2. Create a table EMPLOYEE with following schema: (Emp_no, E_name, E_address, E_ph_no, Dept_no,
Dept_name, Job_id, Salary)
Write SQL queries for following question:
a. Insert a least 5 rows in the table.
b. Display all the information of EMP table.
c. Update the city of Emp_no-12 with current city as Nagpur.
d. List out different SQL commands? Write their basic structure

3. Create a table EMPLOYEE with following schema: (Emp_no, E_name, E_address, E_ph_no, Dept_no,
Dept_name, Job_id, Salary)
Write SQL queries for following question:
a. Display the details of Employee who works in department MECH.
b. Delete the email_id of employee James.
c. Display the complete record of employees working in SALES Department.
d.State the difference between primay key,unique key,not null with an example

4. Create a table EMPLOYEE with following schema:


Write SQL queries for following question:
a. Count number of employee names from employee table.
b. Find the Maximum age from employee table.
c. Find the Minimum age from employee table.
d. List out the types of notations used in ER-Diagram

5. Create a table EMPLOYEE with following schema:

a. Find grouped salaries of employees. (group by clause)


b. Find salaries of employee in Ascending Order. (order by clause)
c. Find salaries of employee in Descending Order.
d. Explain the following terms with example i)Entity ii)Attribute iii)Relationship iv)weak entity
v)Strong Entity.

6. Create a table EMPLOYEE with following schema:

a. Insert the any three records in the employee table. Check the result.
b. Add primary key constraint and not null constraint to the employee table.
c. Insert null values to the employee table and verify the result.
d. Explain the following terms with examples i) Derived attribute ii) Composite attribute iii)Strong Entity
7. Create a table sailor, reserves, boats:

a. Find the names of sailors who have reserved both a red and a green boat. (Intersect)
b. Find the names of sailors who have reserved both a red and a green boat. (union all)
c. Find the names of sailors who have reserved boat 103. (Exists)
d. Explain about different Aggregate functions with an example?

8. Create a table sailor, reserves, boats:

a. Find the average age of sailors with a rating of 10?


b. Find the name and age of the oldest sailor?
c. Find the age of the youngest sailor for each rating level?

d. Find the average age of sailors for each rating level that has at least two sailors? (group by and Having)
e. What is Normalization? Explain about 1NF and 2NF with an example?
9. Create a table customer and order table:

a. Write a query to perform INNER JOIN for the above tables.


b. Write a query to perform LEFT OUTER JOIN for the above tables.
c. Write a query to perform RIGHT OUTER JOIN for the above tables.
d. Write a query to perform FULL OUTER JOIN for the above tables.
e. Explain the concept of Triggers and its events with an example?

10. Create a table sailor, reserves, boats:

a. Find the names of sailors who have reserved red boat. (Nested Query)
b. Find the names of sailors who have reserved boat number 103. (correlated Nested Query)
c. Find the name and age of the oldest sailor?
d. Write the differences between count () and count (*) with examples?
e. Write the differences between Drop and Delete with examples?
11. Create a table sailor, reserves, boats:

a. Find sailors whose rating is better than some sailor called Horatio. (Any)
b. Find the sailors with the highest rating. (All)
c. Find the names of sailors who have reserved a red and a green boat. (Union)
d. Write about delete, truncate,drop commands with syntax?
e. Compare between primary key and unique key

12. a. Write a PL/SQL code for creation of Trigger to insert data into a table.
b. Write a PL/SQL code for creation of trigger to update data into a table
c. Write a PL/SQL code for creation of trigger to delete data from a table
d. Explain the following terms with examples i) Derived attribute ii) Composite attribute iii)Strong Entity

13. a. Write a PL/SQL code for creation of procedure to view some specified columns from a
table.
b. Write a PL/SQL code for modification of a procedure on specified columns from a table.
c. Write the differences between primary key and unique key with examples?
d. List out the types of Notations used in ER-Diagram

14. a.Write a PL/SQL program that uses cursor operation on any data base.
b. Write a PL/SQL program for displaying multiplication of any number
c. Write a PL/SQL code for creation of trigger to delete data from a table
d. Explain the following terms with examples i) Derived attribute ii) Composite attribute iii)Weak Entity

15. a. Write a PL/SQL code for modification of procedure to view some specified columns from a table.
b. Write a PL/SQL program for displaying multiplication of any number
c. Write a PL/SQL code for creation of Trigger to update data into a table.
d. Explain the following terms with examples i) Multivalued attribute ii) Composite attribute iii)Strong
Entity

16. a) Write a PL/SQL code for creation of procedure to view some specified columns from a table.
b) Write a PL/SQL program for displaying factorial of any number.
c. Write a PL/SQL code for creation of Trigger to insert data into a table.
d. Explain the following terms with examples i) Derived attribute ii) Composite attribute iii)Strong Entity
17. Converting ER Model to Relational Model (Represent entities and relationships in Tabular form, represent
attributes as columns, identifying keys)

a. Write the differences between count () and count (*) with examples?
b. Write the differences between Drop and Delete with examples?

18. Create tables for following schemas

Students(sid: string, name: string, login: string, age: integer, gpa: real)
Faculty(fid: string, fname: string, sal: real)
Courses(cid: string, cname: string, credits: integer)
a. write a sql query to drop a column in students table.
b. Write a query to rename table students to STUDENT
c. Write a query to insert three rows in each table.
d. Write about delete, truncate,drop commands with syntax?
e. Differrence between primary key and unique key

19.

a)Difference between primary key , unique key, Not Null with an example?
20. Create a table called EMP with the following structure.
Name Type
---------- ----------------------
EMPNO NUMBER(6)
ENAME VARCHAR2(20)
JOB VARCHAR2(10)
DEPTNO NUMBER(3)
SAL NUMBER(7,2)
Create Dept table with the following structure.

Name Type
--------- --- ---------------------
DEPTNO NUMBER(2)
DNAME VARCHAR2(10)
LOC VARCHAR2(10)
i) Insert into a single record in dept table
ii)Display specify columns in emp table
iii) Delete only the data working as Lecturer
iv) List the records in emp table by salary in ascending order.
v) Update the emp table to set salary of all employees to RS.14000 who are working as
Manager.
vi) Write the differences between count() and count(*) with examples

21. Create a table called EMP with the following structure.


Name Type
---------- ----------------------
EMPNO NUMBER(6)
ENAME VARCHAR2(20)
JOB VARCHAR2(10)
DEPTNO NUMBER(3)
SAL NUMBER(7,2)
Create Dept table with the following structure.

Name Type
--------- --- ---------------------
DEPTNO NUMBER(2)
DNAME VARCHAR2(10)
LOC VARCHAR2(10)
i) Add a column experience to the emp table.
ii) Modify the column width of the job field of emp table.
iii) create the emp1 table with ename and empno, add constraints to check the empno
value while entering (i.e) empno > 100
iv) Drop any column in the emp table.
v) Rename any column in dept table.
vi) List out different SQL commands? Write their basic structure
22. Concept design with E-R Model Consider the following information about a university database:
 Professors have an SSN, a name, an age, a rank, and a research specialty.
 Projects have a project number, a sponsor name (e.g., NSF), a starting date, an ending date, and a budget.
 Graduate students have an SSN, a name, an age, and a degree program (e.g., M.S. or Ph.D.).
 Each project is managed by one professor (known as the project’s principal investigator).
 Each project is worked on by one or more professors (known as the project’s co-investigators).
 Professors can manage and/or work on multiple projects.
 Each project is worked on by one or more graduate students (known as the
project’s research assistants).
 When graduate students work on a project, a professor must supervise their work on the project. Graduate
students can work on multiple projects, in which case
they will have a (potentially different) supervisor for each one.
 Departments have a department number, a department name, and a main office.
 Departments have a professor (known as the chairman) who runs the department.
 Professors work in one or more departments, and for each department that they
work in, a time percentage is associated with their job.
 Graduate students have one major department in which they are working on their
degree.
 Each graduate student has another, more senior graduate student (known as a
student advisor) who advises him or her on what courses to take.
i).Write about delete, truncate,drop commands with syntax ii)Differrence between primary key and unique key

23. a) Analyze the problem carefully and come up with the attributes of given entities and relationships.
Identify the primary keys for all the entities. Identify the other keys like candidate keys, partial keys, if any.

Entities: 1. BUS 2. Ticket3. Passenger


Relationships: 1. Reservation 2. Cancellation
b) Write a PL/SQL program that uses all cursor operation on reserves data base.

24. Create an Employee table with the following data, insert 10 records & display?

Tablename: EMPLOYEE123

Attributes Domain Constraint type

Empid Varchar2(10) Primary key

Name Varchar2(15) UNIQUE

Job Varchar2(10)

address Varchar2(35)

Salary Number(10,2)

DOJ Date

a. Insert 5 records into employee table


b. Perform update and delete operation on employee table
c. Perform Aggregate functions with Syntax and examples
d. Display the names of employees starting with ‘P’ letter.
e. Write a PL/SQL program that uses all cursor operation on reserves data base.

25. Create a MERCHANT table with the following data and perform the below Operations?

Tablename: MERCHANT100
Attributes Datatype Constraint
type
Mer_id Varchar2(10)
Name Varchar2(15) Unique
age Integer
budget Number(12,2) Check
>=100000

a. Add a New column “Address” with data type “Varchar2 (15)” to the existing table.
b. Modify the size of “Address” to “varchar2 (35)”.
c. Drop a column “age” from the table.
d. Add “Primary key” constraint for the “Mer-Id” Attribute.
e. Insert 5 records & display them.
f. List out different SQL commands? Write their basic structure

You might also like