2024 Model Answer Paper
2024 Model Answer Paper
Model Answer
Subject Name: Database Management System Subject Code:313302
Variety
Big Data can be structured, unstructured, and semi-structured that
are being collected from different sources. Data will only be
collected from databases and sheets in the past, But these days the
data will come in array forms, that are PDFs, Emails, audios, SM
posts, photos, videos, etc.
Example: Web server logs, i.e., the log file is created and
maintained by some server that contains a list of activities.
Veracity
Veracity means how reliable the data is. It has many ways to filter or
translate the data. Veracity is the process of being able to handle and
manage data efficiently.
Example: Facebook posts with hashtags.
Value
Value is an essential characteristic of big data. It is not the data that
we process or store. It is valuable and reliable data that we store,
process, and also analyze.
Velocity
Velocity plays an important role compared to others. Velocity creates
the speed by which the data is created in real-time. It contains the
linking of incoming data sets speeds, rate of change, and activity
bursts. The primary aspect of Big Data is to provide demanding data
rapidly.
e 2M Draw PL/SQL Block Structure 2 Mark
Ans SET SERVEROUTPUT ON;
DECLARE
-- Variable and cursor declarations
BEGIN
-- PL/SQL executable statements
EXCEPTION
-- Exception handling code
END;
/
• Triggers reduce the client-side code that saves time and effort.
g 2M Write a syntax of create table command for creating table with 2 Mark
Ans primary key constraint
Syntax:
CREATE TABLE table_name (
column1 data_type, …....,
[CONSTRAINT constraint_name] PRIMARY KEY (column1));
OR
CREATE TABLE table_name ( column_1 datatype Primary Key,
column_2 datatype, …………, column_n datatype);
a 4M List and explain any four advantages of DBMS over traditional Any 4 Points
Ans file processing systems. 1 Mark Each
1. Data redundancy and inconsistency: Redundancy is the
concept of repetition of data i.e. each data may have more than a
single copy. The file system cannot control the redundancy of data
as each user defines and maintains the needed files for a specific
application to run. There may be a possibility that two users are
maintaining the data of the same file for different applications.
Hence changes made by one user do not reflect in files used by
second users, which leads to inconsistency of data. Whereas
DBMS controls redundancy by maintaining a single repository of
data that is defined once and is accessed by many users. As there is
no or less redundancy, data remains consistent.
2. Data sharing: The file system does not allow sharing of data or
sharing is too complex. Whereas in DBMS, data can be shared
easily due to a centralized system.
3. Data concurrency: Concurrent access to data means more than
one user is accessing the same data at the same time. Anomalies
occur when changes made by one user get lost because of changes
made by another user. The file system does not provide any
procedure to stop anomalies. Whereas DBMS provides a locking
system to stop anomalies to occur.
4. Data searching: For every search operation performed on the
file system, a different application program has to be written.
While DBMS provides inbuilt searching operations. The user only
has to write a small query to retrieve data from the database.
5. Data integrity: There may be cases when some constraints need
to be applied to the data before inserting it into the database. The
file system does not provide any procedure to check these
constraints automatically. Whereas DBMS maintains data integrity
by enforcing user-defined constraints on data by itself.
6. System crashing: In some cases, systems might have crashed
due to various reasons. It is a bane in the case of file systems
because once the system crashes, there will be no recovery of the
data that’s been lost. A DBMS will have the recovery manager
which retrieves the data making it another advantage over file
systems.
7. Data security: A file system provides a password mechanism to
protect the database
but how long can the password be protected? No one can guarantee
that. This doesn’t happens in the case of DBMS. DBMS has
specialized features that help provide shielding to its data.
8. Backup: It creates a backup subsystem to restore the data if
required.
9. Interfaces: It provides different multiple user interfaces like
graphical user interface and application program interface.
10. Easy Maintenance: It is easily maintainable due to its
centralized nature.
i) Database Administrator :
Database administrator is responsible for managing the whole
database system. He/she designs, creates and maintains the
databases. He/she also manages the users who can access this
database and controls the integrity issues. He/she also monitors the
performance of the system and makes changes in the system as and
when required.
ii) Naive and Parametric End Users :
These are the people who use permanent application programs.
Examples of such users are airline reservation clerk, bank teller,
data entry clerks, etc.
iii) Sophisticated End Users :
These are the users who are familiar with the DBMS facilities like
engineers and business analysts. They interact with the system
through their requests written using a database query language.
Sophisticated users are the users who are familiar with the
structures of databases and facilities of DBMS. They use queries
such as SQL to perform the operation on the database.
iv) Application Programmers :
Application programmer is the person who is responsible for
implementing the required functionality of the database for the end
users. They work according to the specification provided by the
system analyst.
d 4M Differentiate between function and procedure. (any four point) 1 Mark each
Ans
b 4M State the difference between instance and schema. State and Definition
Ans explain the types of data independence 2 Mark
Definition of schema: Design of a database is called the schema. Explanation
Schema can be changed infrequently as information is inserted and 2 Mark
deleted.
Definition of instance: The data stored in a database at a particular
moment of time is called an instance of the database.
•Database schema defines the variable declarations in tables that
belong to a particular database; the value of these variables at a
moment of time is called the instance of that database.
Data Independence
Definition-The ability to modify a schema definition in one level
without affecting a schema definition in a higher level is called Data
Independence
.
Types of Data Independence:
1) Physical data independence
•The ability to modify the physical schema without causing
application programs to be rewritten
•Modifications at this level are usually to improve performance
2) Logical data independence
•The ability to modify the conceptual schema without causing
application programs to be rewritten
•Usually done when logical structure of database is altered
•Logical data independence is harder to achieve as the application
programs are usually heavily dependent on the logical structure of
the data. An analogy is made to abstract data types in programming
languages.
c 4M Compare strong entity set and weak entity set with example Any 4 Point
Ans (any four points) 4 Marks
d 4M List and explain types of joins ½ Marks for
Ans Joins: As the term suggests, SQL JOINs refers to a clause in SQL listing each
that is used to combine rows of two or more tables by using Types
common values. ½ mark for
INNER JOIN explanation
INNER JOIN statement returns only those records or rows that
have matching values and is used to retrieve data that appears in
both tables.
Syntax:
SELECT columns
FROM table1
INNER JOIN table2 ON table1.column = table2.column;
OUTER JOIN
When applying an SQL INNER JOIN, the output returns only
matching rows from the stated tables. In contrast, if you use an SQL
OUTER JOIN, it will retrieve not only the matching rows but also
the unmatched rows as well.
Syntax:
SELECT columns
FROM table1
FULL JOIN table2 ON table1.column = table2.column;
LEFT OUTER JOIN
Left Outer Join returns all the rows from the table on the left and
columns of the table on the right is null padded. Left Outer Join
retrieves all the rows from both the tables that satisfy the join
condition along with the unmatched rows of the left table.
Syntax:
SELECT columns
FROM table1
LEFT JOIN table2 ON table1.column = table2.column;
RIGHT OUTER JOIN
The RIGHT OUTER JOIN works by the same principle as the
LEFT OUTER JOIN. The RIGHT OUTER JOIN selects data
from the right table (Table B) and matches this data with the rows
from the left table (Table A). The RIGHT JOIN returns a result set
that includes all rows in the right table, whether or not they have
matching rows from the left table. In case, a row in the right table
does not have any matching rows in the left table, the column of the
left table in the result set will have nulls.
Syntax:
SELECT columns
FROM table1
RIGHT JOIN table2 ON table1.column = table2.column;
SELF JOIN
The SELF JOIN allows you to join a table to itself. This implies
that each row of the table is combined with itself and with every
other row of the table. The SELF JOIN can be viewed as a join of
two copies of the same table. The table is not actually copied, but
SQL performs the command as though it were. This is
accomplished by using table name aliases to give each instance of
the table a separate name. It is most useful for extracting
hierarchical data or comparing rows within the same table.
Syntax:
SELECT t1.column1, t2.column2
FROM table AS t1
JOIN table AS t2 ON t1.related_column = t2.related_column;
CROSS JOIN
The CROSS JOIN command in SQL, also known as a cartesian
join, returns all combinations of rows from each table. Envision that
you need to find all combinations of size and color. In that case, a
CROSS JOIN will be an asset. Note, that this join does not need any
condition to join two tables. In fact, CROSS JOIN joins every row
from the first table with every row from the second table and its
result comprises all combinations of records in two tables.
Syntax:
SELECT t1.column1, t1.column2, ..., t2.columnA, t2.columnB, ...
FROM table1
CROSS JOIN table2;
c 6M State the use of sequence. Write and explain the syntax of create
Ans sequence and alter sequence
A sequence is used to generate numbers in sequence. You can use 1 Marks
sequences to insertunique values in Primary Key and Unique Key each
columns of tables.
CALLING FUNCTION
DECLARE
customer_age NUMBER;
BEGIN
customer_age := get_customer_age(101);
IF customer_age IS NOT NULL THEN
DBMS_OUTPUT.PUT_LINE('The age of the customer is: ' ||
customer_age);
ELSE
DBMS_OUTPUT.PUT_LINE('Customer age could not be
determined.');
END IF;
END;
/
ii)
SELECT
sr.rn AS Roll_Number,
SUM(sr.smarks) AS Total_Marks
FROM
stud_result sr
GROUP BY
sr.rn;
iii)
SELECT
sr.subid AS Subject_ID,
AVG(sr.smarks) AS Average_Marks
FROM
stud_result sr
GROUP BY
sr.subid;
c 6M Explain the super key, Candidate key, Primary key and Foreign key Explanation
Ans with example 1 Mark each
Keys
•Keys play an important role in the relational database. Example
•It is used to uniquely identify any record or row of data from the table. ½ Mark
Each
It is also used to establish and identify relationships between tables.
Types of keys:
1. Primary key
•It is the first key used to identify one and only one instance of an entity
uniquely. An entity can contain multiple keys, as we saw in the PERSON
table. The key which is most suitable from those lists becomes a primary
key.
•In the EMPLOYEE table, ID can be the primary key since it is unique
for each employee. In the EMPLOYEE table, we can even select
License_Number and Passport_Number as primary keys since they are
also unique.
•For each entity, the primary key selection is based on requirements and
developers.
2. Candidate key
•A candidate key is an attribute or set of attributes that can uniquely
identify a tuple.
•Except for the primary key, the remaining attributes are considered a
candidate key. The candidate keys are as strong as the primary key.
•
For example: In the EMPLOYEE table, id is best suited for the primary
key. The rest of the attributes, like SSN, Passport_Number,
License_Number, etc., are considered a candidate key.
3. Super Key
Super key is an attribute set that can uniquely identify a tuple. A super
key is a superset of a candidate key.
For example: In the below EMPLOYEE table, for(EMPLOEE_ID,
EMPLOYEE_NAME), the name of two employees can be the same, but
their EMPLYEE_ID can't be the same. Hence, this combination can also
be a key.
The super key would be EMPLOYEE-ID (EMPLOYEE_ID,
EMPLOYEE-NAME), etc.