DMS Model-Answer-Paper-Summer-2023
DMS Model-Answer-Paper-Summer-2023
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
Page 1 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
Example
For Example: 1M
Select * from customer where age = ( Select min(age) from customer );
The above query will select all rows from customer table with minimum age.
d) Define 2M
i) Primary Key
ii) Candidate Key
Ans Primary Key : A primary key is the column or columns that contain values that 1M for
uniquely identify each row in a table. A primary key does not allow duplicate each
values and null values. definition
Candidate Key: The minimal set of attributes that can uniquely identify a tuple is
known as a candidate key. A table can have multiple candidate keys, but can only
have one primary key.
Page 2 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
5. Alter
Syntax: i) Alter table < table_name> add (Column_name Datatype (size));
ii)Alter table <table_name> drop(Column_name);
iii)Alter table <table_name> rename column(old column_name to new
column_name);
Page 3 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
Rollno number(4),
Name varchar(255),
Marks number(3),
Age number(3) constraint ck CHECK (Age>=18)
);
Page 4 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
For Example:
create trigger trigger_update
on emp
after update
as begin Select * from employee;
end;
The above trigger will invoke after update of record in emp table.
Page 5 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
Isolation: In a database system where more than one transactions are being
executed simultaneously and in parallel, the property of isolation states that all
the transactions will be carried out and executed as if it is the only transaction
in the system. No transaction will affect the existence of any other transaction.
Durability: The database should be durable enough to hold all its latest
updates even if the system fails or restarts. If a transaction updates a chunk of
data in a database and commits, then the database will hold the modified data.
If a transaction commits but the system fails before the data could be written on
to the disk, then that data will be updated once the system springs back into
action.
Page 6 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
c) Write step by step syntax to create, open, and close cursor in PL/SQL 4M
Ans A cursor is a temporary work area created in system memory when an SQL
2M for
statement is executed. A cursor is a set of rows together with a pointer that Create
identifies a current row. It is a database object to retrieve data from result set on
1M for
row at a time. Open
Steps:
1M for
1. Declare cursor: This refers to initialize the cursor with an associative select Close
statement. This is done in the declaration section of PL/SQL program. Before
using an explicit cursor, you must declare it in the declaration section of a block
or package as follows:
CURSOR cursor_name IS query;
2. Open: This refers to allocate the memory for the cursor. This step is done
before the cursor is used to fetch the records. Before start fetching rows from the
cursor, you must open it. To open a cursor, you use the following syntax:
OPEN cursor_name;
3. Close: This refers to release the allocated cursor. Once the processing of the
data is done, the cursor can be closed. After fetching all rows, you need to close
the cursor with the CLOSE statement:
CLOSE cursor_name;
Page 7 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
Page 8 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
Page 9 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
We use select command for displaying or viewing the records from a table or
tables.
Syntax:
Select <*/ list of columns> from <table name> [where <condition> ] ;
Ex :
Select * from Student;
Select R_N0,Name,DOB from Student where Percentage > 80;
Page 10 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
Page 11 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
Example:
Employee is a strong entity because it has a primary key attribute called
Employee number (Employee_No) which is capable of uniquely
identifying all the employee.Unlike Employee, Dependents is weak entity
because it does not have any primary key .
Use of
correct
entities
1M
Correct
relations
hips 1M
Page 12 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
Correct
symbols
1½M
Correct
relations
hips
1½M
Primary
key
1M,
Weak
entity
1M,
Strong
Entity
1M
Page 14 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
The above relation is in 1NF as all the domains are having atomic value. But it is
not in 2NF.
Second Normal Form (2NF): A relation is said to be in the second normal form if
it is in first normal form and all the non key attributes are fully functionally
dependent on the primary key.
Example: In the above relation NAME, LOCATION depends on SNO and QTY
on
Supplier SP
Page 15 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
Syntax:
SELECT tablename.column1_name,tablename.column2_name
FROM table_name1,table_name2
where table_name1.column_name=table_name2.column_name;
Example:
Select stud_info.stud_name, stud_info.branch_code,
branch_details.location
From stud_info, branch_details
Where Stud_info.branch_code=branch_details.branch_code;
2) SELF JOIN:
The SQL SELF JOIN is used to join a table to itself, as if the table were two
tables,temporarily renaming at least one table in the SQL statement.
Syntax:
SELECT a.column_name, b.column_name
FROM table1 a, table1 b
WHERE a.common_filed = b.common_field;
Example:
Select x.stud_name, y.stud_name
from stud_info x, stud_info y
Where x.leader= y.stud_id;
Page 16 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Subject Name: Database Management System Subject Code: 22319
Example:
Select last_name, department_name
from employees inner join departments
on employees.department_id = departments.department_id;
Page 17 / 18
MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
SUMMER – 2023 EXAMINATION
-
Example:
Select last_name,department_name from employees e, departments
d on
e.department_id = d.department_id(+);
OR
Select last_name, department_name
from employees e right outer join departments d
on e.department_id = d.department_id;
6) NON EQUI JOIN:
Non equi joins is used to return result from two or more tables where exact
join is
not possible.
Syntax:
Select aliasname.column1name, aliasname.column2name from
tablename alias
where <condition using range>;
Example:
In emp table and salgrade table. The salgrade table contains grade and their
low salary and high salary. Suppose you want to find the grade of
employees based on their salaries then you can use NON EQUI join. Select
e.empno, e.ename, e.sal, s.grade
from emp e, salgrade s
where e.sal between s.lowsal and s.hisal;
Page 18 / 18