DBMS LabViva Qns
DBMS LabViva Qns
1. Define Database
2. Database-management system (DBMS): is a collection of interrelated data and a set of programs to access those
data. General purpose software system that facilitates process of defining, constructing, manipulating, and sharing
database. DBMS is a general purpose software system that facilitates process of defining, constructing, manipulating,
and sharing database. We call the database and DBMS software together a database system.
The characteristic that allows program-data independence and program operation independence is called data
abstraction. A data model is a type of data abstraction that is used to provide conceptual representation
4. Concurrency
DBMS must include concurrency control software to ensure that several users trying to update the same data do so in
a controlled manner so that the result of the updates is correct
5. Isolation property
Ensures that each transaction appears to execute in isolation from other transactions even though hundreds of
transactions may be executing concurrently.
6. Atomicity Property
Ensures that either all the database operations in a transaction are executed or none are. Any mechanical or electrical
device is subject to failure, and so is the computer system. In this case we have to ensure that data should be restored
to a consistent state.
7. Advantages of DBMS
Controlling Redundancy
Restricting Unauthorized Access
Providing Storage Structures for Efficient
Query Processing
Providing Backup and Recovery
Providing Multiple User Interfaces
Representing Complex Relationship among Data
Enforcing Integrity Constraints
Permitting Inferencing and Actions using Rules
8. Disadvantages of DBMS
Semi-Structured data
Information that does not reside in a relational database but that have some organizational properties that make it
easier to analyse. With some process, you can store them in the relation database. Eg: XML data.
Unstructured data
Data which is not organized in a predefined manner or does not have a predefined data model, thus it is not a good fit
for a mainstream relational database there are alternative platforms for storing and managing, it is increasingly
prevalent in IT systems and is used by organizations in a variety of business intelligence and analytics applications.
11. An attribute represents some property of interest that further describes an entity.
12. A relationship among two or more entities represents an interaction among the entities.
The schema is not supposed to change frequently, but it is not uncommon that changes occasionally need to be applied
to the schema as the application requirements change. It is called schema evolution.
14. Mapping
The processes of transforming requests and results between levels are called mappings.
The capacity to change the schema at one level of a database system without having to change
Data definition language ( DDL ), is used by the to define conceptual and internal schemas.
View definition language ( VDL ), to specify user views and their mappings to conceptual schema
Data Manipulation Language(DML) is used for retrieval, insertion, deletion, and modificationDBA and by database
designers
1. Centralized database
18. ER Diagram
In some cases same entity type participate more than once in a relationship type in different roles, so in this role name
is essential for distinguishing meaning of the role the participating entity plays they are recursive relationships.
• Unary relationship
• Binary Relationship
• Ternary Relationship
• Domains
• Tuples (rows)
• Columns (attributes)
• Keys
• Relations (Tables)
SQL queries on single and multiple tables, Nested queries (correlated and non-correlated), Aggregation and grouping,
Views, assertions, Triggers, SQL data types.
The SQL DML provides the ability to query information from the database and to insert tuples into, delete tuples
from, and modify tuples in the database.
▫ Integrity: The SQL DDL includes commands for specifying integrity constraints that the data stored in the database
must satisfy. Updates that violate integrity constraints are disallowed.
▫ View definition: The SQL DDL includes commands for defining views.
▫ Transaction control: SQL includes commands for specifying the beginning and ending of
transactions.
SQL has one basic statement for retrieving information from a database; the SELECT statement
25.
you can use a PL/SQL package to store all related functions and procedures in one unit. It allows the memory to load
multiple objects and allows all the code blocks to run simultaneously while reducing traffic. Both these factors help
improve performance. With a PL/SQL package, developers can implement the object-oriented design in a top-down
fashion. They can create the interface by referring to hidden code in the PL/SQL package. If you modify one module
in a PL/SQL package, you can make similar changes in another.
27. What is the command you use to get the privileges offered by Grant command?
REVOKE
PL/SQL packages are a way to organize and encapsulate related procedures, functions, variables, triggers, and other
PL/SQL items into a single item. Packages provide a modular approach to write and maintain the code. It makes it
easy to manage large codes.
A package is compiled and then stored in the database, which then can be shared with many applications. The package
also has specifications, which declare an item to be public or private. Public items can be referenced from outside of
the package.
A PL/SQL package is a collection of related Procedures, Functions, Variables, and other elements that are grouped for
Modularity and Reusability.
• Modularity: Packages provide a modular structure, allowing developers to organize and manage code
efficiently.
• Code Reusability: Procedures and functions within a package can be reused across multiple programs,
reducing redundancy.
• Private Elements: Packages support private procedures and functions, limiting access to certain code
components.
• Encapsulation: Packages encapsulate related logic, protecting internal details and promoting a clear interface
to other parts of the code.
• A package Specification
• A package Body
An exception is an error which disrupts the normal flow of program instructions. PL/SQL provides us the exception
block which raises the exception thus helping the programmer to find out the fault and resolve it.
• Simple View: A view based on only a single table, which doesn't contain GROUP BY clause and any
functions.
• Complex View: A view based on multiple tables, which contain GROUP BY clause and functions.
A cursor is a named control structure used by an application program to point to and select a row of data from a result
set. Instead of executing a query all at once, you can use a cursor to read and process the query result set one row at a
time.
The life cycle of the cursor is described into the following five stages:
• Declare a Cursor.
• Open Cursor.
• Fetch Data from Cursor.
• Close Cursor Connection.
• Deallocate cursor.
The NVL function is used to replace NULL values with a default value in a database query. It is primarily used to
provide more meaningful data when NULL values are encountered in query results.
37. How would you differentiate between the cursors declared in procedures and those declared in package
specifications?
The main difference between cursors declared in procedures and those declared in package specifications is that
packaged cursors are global cursors that remain open until closed or the session is disconnected.
The Actual parameters are the variables that are transferred to the function when it is requested. The Formal
Parameters are the values determined by the function that accepts values when the function is declared.
A Flashback Query is a query that retrieves data from a database as it was at a specific point in time. The query uses a
timestamp or SCN to reference the past time. The results returned are the committed data that was current at that time.
In the context of PL/SQL, polymorphism refers to the ability of a program to treat different data types in a unified
manner. Polymorphism allows developers to create generic code that can operate on various data types, providing
flexibility and reusability in their applications.