Professional Documents
Culture Documents
Questio S Answers of DBM S
Questio S Answers of DBM S
Functionalities of DBMS
• Modify, delete, insert the data.
• Security
• Transaction management.
• Data Independency
DBMS Components
• Data Dictionary
• Query Processor
• Query Optimizer
• Integrity Checker
• Transaction Manager
• Scheduler
• Recovery Manager
• Buffer Manager
• Authorization Control
Query Optimization
The optimizer attempts to generate the most optimal execution plan for a SQL statement.
The optimizer choose the plan with the lowest cost among all considered candidate plans
Data Dictionary
• Data Dictionary is a repository of information about data in a database or a data set . Every
change in database structure is automatically reflected in the data dictionary.
Acid Properties
Attribute
Types of Attributes
Key Attribute:
The attribute which uniquely identifies each entity in the entity set is called key
attribute.
Derived Attributes:
An attribute which can be derived from other attributes of the entity type is
known as derived attribute
Multivalued Attribute:
Composite Attribute:
Weak Entity
An entity set which is not having any single attribute for unique identification is a
weak entity. In ER diagram Weak entity is represented by the double rectangle.
Degree of Relationship
Generalization
Specialization
Key
• Types of Keys:
Super Key
Candidate Key
Primary Key
Alternate Key
SUPER KEYS:
Any set of attributes that allows us to identify unique rows (tuples) in a
given relation are known as super keys. Or Superset of any candidate key is
a super key.
Candidate Key: A super key whose proper subset is not a super key is the
candidate key. Also we can say, Minimal Super key is the candidate Key.
Primary Key: A Candidate Key whose value can not be null is the primary
key.
Alternate Key: Keys which are candidate key and not primary key are the
alternate keys.
Foreign Key
Set of attribute that references to primary key of the Same or some other relation
While designing Relational Model, we define some conditions which must hold for
data present in database are called Constraints. These constraints are checked
before performing any operation
Domain Constraints:
These are attribute level constraints. An attribute can only take values which lie
inside the domain range
Every relation in the database should have atleast one set of attributes which
defines a tuple uniquely. Key should be unique for all tuples and key can’t have
NULL values.
Referential Integrity:
When one attribute of a relation can only take values from other attribute of same relation or any other
relation, it is called referential integrity
ANOMALIES
Insertion Anomaly:
o Redundancy control
o Restriction for unauthorized access
o Provides multiple user interfaces
o Provides backup and recovery
o Enforces integrity constraints
o Ensure data consistency
o Easy accessibility
o Easy data extraction and data processing due to the use of queries
o Data Definition Language (DDL) e.g., CREATE, ALTER, DROP, TRUNCATE, RENAME, etc.
All these commands are used for updating the data that?s why they are known as Data
Definition Language.
o Data Manipulation Language (DML) e.g., SELECT, UPDATE, INSERT, DELETE, etc. These
commands are used for the manipulation of already updated data that's why they are
the part of Data Manipulation Language.
o DATA Control Language (DCL) e.g., GRANT and REVOKE. These commands are used
for giving and removing the user access on the database. So, they are the part of Data
Control Language.
o Transaction Control Language (TCL) e.g., COMMIT, ROLLBACK, and SAVEPOINT. These
are the commands used for managing transactions in the database. TCL is used for
managing the changes made by DML.
One-To-One: Here one record of any object can be related to one record of another object.
One-To-Many (many-to-one): Here one record of any object can be related to many records
of other object and vice versa.
Many-to-many: Here more than one records of an object can be related to n number of
records of another object.
Physical level: It is the lowest level of abstraction. It describes how data are stored.
Logical level: It is the next higher level of abstraction. It describes what data are stored in the
database and what the relationship among those data is.
View level: It is the highest level of data abstraction. It describes only part of the entire
database.
For example- User interacts with the system using the GUI and fill the required details, but the
user doesn't have any idea how the data is being used. So, the abstraction level is entirely high
in VIEW LEVEL.
Then, the next level is for PROGRAMMERS as in this level the fields and records are visible and
the programmers have the knowledge of this layer. So, the level of abstraction here is a little low
in VIEW LEVEL.
Procedural DML or Low level DML: It requires a user to specify what data are needed and how
to get those data.
Non-Procedural DML or High level DML:It requires a user to specify what data are needed
without specifying how to get those data.
What is normalization?
Normalization is a process of analysing the given relation schemas according to their functional dependencies. It is
used to minimize redundancy and also used to minimize insertion, deletion and update distractions. Normalization is
considered as an essential process as it is used to avoid data redundancy, insertion anomaly, updation anomaly,
deletion anomaly.
It makes you able to modify the schema definition in one level should not affect the schema
definition in the next higher level.
Physical Data Independence: Physical data is the data stored in the database. It is in the bit-
format. Modification in physical level should not affect the logical level.
For example: If we want to manipulate the data inside any table that should not change the
format of the table.
Logical Data Independence: Logical data in the data about the database. It basically defines
the structure. Such as tables stored in the database. Modification in logical level should not
affect the view level.
For example: If we need to modify the format of any table, that modification should not affect
the data inside it.
What is Join?
It is most commonly used way to combine information from two or more relations. A Join is
always performed on the basis of the same or related column. Most complex queries of SQL
involve JOIN command.
What is 1NF?
1NF is the First Normal Form. It is the simplest type of normalization that you can implement
in a database. The primary objectives of 1NF are to:
What is 2NF?
2NF is the Second Normal Form. A table is said to be 2NF if it follows the following conditions:
o The table is in 1NF, i.e., firstly it is necessary that the table should follow the rules of 1NF.
o Every non-prime attribute is fully functionally dependent on the primary key, i.e., every
non-key attribute should be dependent on the primary key in such a way that if any key
element is deleted, then even the non_key element will still be saved in the database.
What is 3NF?
3NF stands for Third Normal Form. A database is called in 3NF if it satisfies the following conditions:
ACID properties are some basic rules, which has to be satisfied by every transaction to preserve the integrity. These
properties and rules are:
ATOMICITY: Atomicity is more generally known as ?all or nothing rule.' Which implies all are considered as one unit,
and they either run to completion or not executed at all.
CONSISTENCY: This property refers to the uniformity of the data. Consistency implies that the database is consistent
before and after the transaction.
ISOLATION: This property states that the number of the transaction can be executed concurrently without leading to
the inconsistency of the database state.
DURABILITY: This property ensures that once the transaction is committed it will be stored in the non-volatile
memory and system crash can also not affect it anymore.
The 2-Tier architecture is the same as basic client-server. In the two-tier architecture, applications on the client end
can directly communicate with the database at the server side.
Candidate key: The Candidate key is an attribute or set of an attribute which can uniquely
identify a tuple. The Primary key can be selected from these attributes.
Super key: The Super key is a set of attributes which can uniquely identify a tuple. Super key is a
superset of the candidate key.
Foreign key: The Foreign key is a primary key from one table, which has a relationship with
another table. It acts as a cross-reference between tables.