Nothing Special   »   [go: up one dir, main page]

Dbms Cheat Sheet

Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 5

1.What is DBMS ? Mention advantages..

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:

Reducing Data Redundancy


More secure
2.What is Database?

A database is an organized collection of data, so that it can be easily accessed and managed.

3. What is a database system?


Database management system is a software which is used to manage the database.
DBMS allows users the following tasks:
Data Definition:
Data Updation:
Data Retrieval:

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

Relational databases have the following properties:

a.All of the values in a column have the same data type.

b.Each row is unique.

c.Each column has a unique name.

5.Types of database languages

Database languages can be used to read, store and update the data in the database.

There are 4 types of database languages:

DDL

DDL stands for Data Definition Language. It is used to define database structure or pattern.

· It is used to create schema, tables, indexes, constraints, etc. in the database.


· Using the DDL statements, you can create the skeleton of the database.

· 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:

· Create: It is used to create objects in the database.

· Alter: It is used to alter the structure of the database.

· Drop: It is used to delete objects from the database.

· Truncate: It is used to remove all records from a table.

· Rename: It is used to rename an object.

· Comment: It is used to comment on the data dictionary.

DCL

DCL stands for Data Control Language. It is used to retrieve the stored or saved data.

· The DCL execution is transactional. It also has rollback parameters.

(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:

· Grant: It is used to give user access privileges to a database.

· Revoke: It is used to take back permissions from the user.

DML

DML stands for Data Manipulation Language. It is used for accessing and manipulating data in a database. It handles user
requests.

Here are some tasks that come under DML:

· Select: It is used to retrieve data from a database.

· Insert: It is used to insert data into a table.

· Update: It is used to update existing data within a table.

· Delete: It is used to delete all records from a table.

· Merge: It performs UPSERT operation, i.e., insert or update operations.

· Call: It is used to call a structured query language or a Java subprogram.


· Explain Plan: It has the parameter of explaining data.

· Lock Table: It controls concurrency.

TCL

TCL is used to run the changes made by the DML statement. TCL can be grouped into a logical transaction.

Here are some tasks that come under TCL:

· Commit: It is used to save the transaction on the database.

· 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. )

I- ISOLATION(where no data should affect the other one )


D- DURABILITY(durability ensures that the data after the successful execution of the operation becomes permanent in
the database.)

7. Difference between vertical and horizontal scaling

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

It is a type of DataBase partitioning in which a large DataBase is divided or partitioned into


smaller data, also known as shards. These shards are not only smaller, but also faster and
hence easily manageable.

Need for 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

keys are the part of relational databases

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

Super key is a superset of a candidate 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

THREE types of realtionships are:

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.

One-to-Many or Many-to-One Relationship

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.

You might also like