Dbms Cheat Sheet
Dbms Cheat Sheet
Dbms Cheat Sheet
A Database Management System (DBMS) is defined as the software system that allows users to
define, create, maintain and control access to the database.
DBMS makes it possible for end users to create, read, update and delete data in database. It is a
layer between programs and data.
Advantages:
A database is an organized collection of data, so that it can be easily accessed and managed.
4.What is RDBMS
RDBMS stands for Relational Database Management Systems..
in RDBMS data is represented in terms of tables where each table has its own primary key
Database languages can be used to read, store and update the data in the database.
DDL
· Data definition language is used to store the information of metadata like the number of tables and
schemas, their names, indexes, columns in each table, constraints, etc.
Here are some tasks that come under DDL:
DCL
(But in Oracle database, the execution of data control language does not have the feature of rolling back.)
Here are some tasks that come under DCL:
DML
DML stands for Data Manipulation Language. It is used for accessing and manipulating data in a database. It handles user
requests.
TCL
TCL is used to run the changes made by the DML statement. TCL can be grouped into a logical transaction.
· Rollback: It is used to restore the database to original since the last Commit.
6. ACID properties
AS WE KNOW THAT INTEGRITY IS ONE OF THE PROPERTIES OF DBMS, SO IN ORDER
TO MAINTAIN THIS PROPERTY THERE ARE SOME PROPERTIES describes called ACID
properties
A – ATOMICITY (EITHER THE OPERATION IS PERFORMED or not performed, there is no in
between)
C- CONSISTENCY(means that the value should remain preserved always ,which means if a change in the database is
made, it should remain preserved always. )
In the scaling process, we either compress or expand the system to meet the expected needs.
Vertical Scaling: When new resources are added in the existing system to meet the expectation,
it is known as vertical scaling.
horizontal scaling: When new server racks are added in the existing system to meet the higher
expectation, it is known as horizontal scaling.
8. What is sharding
Consider a very large database whose sharding has not been done. For example, let’s take a
DataBase of a college in which all the student’s record (present and past) in the whole college
are maintained in a single database. So, it would contain very very large number of data, say
100, 000 records.
Now when we need to find a student from this Database, each time around 100, 000
transactions has to be done to find the student, which is very very costly.
Now consider the same college students records, divided into smaller data shards based on
years. Now each data shard will have around 1000-5000 students records only. So not only the
database became much more manageable, but also the transaction cost of each time also
reduces by a huge factor, which is achieved by Sharding.
9. Keys in DBMS
It is used to uniquely identify any record or row of data from the table. It is also used to establish
and identify relationships between tables.
Primary key
An entity can contain multiple keys The key which is most suitable from those lists become a
primary key.
CANDIDATE KEY
The remaining attributes except for primary key are considered as a candidate key. The
candidate keys are as strong as the primary key.
SUPER KEY
FOREIGN KEY
Foreign keys are the column of the table which is used to point to the primary key of another
table.
In a company, every employee works in a specific department, and employee and department
are two different entities. So we can't store the information of the department in the employee
table. That's why we link these two tables through the primary key of one table.
10.Relationships in DBMS
Any association between two entity types is called a relationship. Entities take part in the
relationship. It is represented by a diamond shape
One-to-One Relationship
Such a relationship exists when each record of one table is related to only one record of the
other table.
For example, If there are two entities ‘Person’ (Id, Name, Age, Address)and
‘Passport’(Passport_id, Passport_no). So, each person can have only one passport and each
passport belongs to only one person.
Such a relationship exists when each record of one table can be related to one or more than
one record of the other table.
For example, If there are two entity type ‘Customer’ and ‘Account’ then each ‘Customer’ can
have more than one ‘Account’ but each ‘Account’ is held by only one ‘Customer’.
Many-to-Many Relationship
Such a relationship exists when each record of the first table can be related to one or more than
one record of the second table and a single record of the second table can be related to one or
more than one record of the first table.
Example: If there are two entity type ‘Customer’ and ‘Product’ then each customer can buy more
than one product and a product can be bought by many different customers.