What is Database?

A database is an organized collection of data that can be stored and accessed electronically. It is actually a set up for easy access, manage and update the data. Before going to dive in database, let's understand what data is.

What is Data?

What is Database

Data is a collection of raw facts. We can say that all the single items that are stored in database are known as data. In simple word, data is a collection of items that has been transferred into a form that is easy to manage.

Generally, a database refers database management system. It is software system that allows user to define create and maintain the database and provide controlled access to the data.

A database is collection of interrelated data which helps in efficient retrieval, insertion deletion of data from the database and organize the data in the form of table. We can say that database is used to store aggregation data records or files that contain information.

For example: A university database organizes a data about student, faculty, admin, staff etc. Data can be accessed, managed, updated, regulated and organized efficiently. For writing and retrieving data, we use Structured Query Language (SQL).

Examples of some database are, MySQL, Oracle, MongoDB etc.

Database allows the following tasks:

Data Definition

It is basically used to define the structure and schema of the database. We can say that it is used to create the database and we can also modify that database.

Data Updation

We can easily update any available data in database. We can update any rows, multiple columns at the same time in the table.

Data Retrieval

It means when we enter the data into database, it gets stored in database, when we want that data, we have to get that data from the database. This process is known as data retrieval.

User Administration

In this, we will do the monitoring of the users. We will maintain data integrity, enforcing data security.

Why do we use a database?

We use database so that we can manage our data in a good and efficient form.

  • Databases are used to store the big chunk of data in effective manner.
  • With the help of database, we can find data very quickly and very easy way.
  •  We can simply add new data and also, we can modify or delete the available data in database.
  • We can search database using technique like indexing, binary searching etc.
  • In database, data sorting is very quick and simple.
  • We can import data into other application easily.
  • The security of database is strong compared to any normal hardcopy files. Because database provide additional security to the users.

Component of Database

There are different types of components in Database. Each component has a specific role in database management system.

What is Database

Hardware

  • The hardware refers to the physical part of the computer system. It includes various storage devices like hard disk and I/O devices.
  • Hardware is the part that is visible to users. It is the most visible part of computer system.
  • Hardware is the actual computer system that is used for storing the database.
What is Database
  • Hardware is used to manage server which have large data storage capacity that allows us to share files on the user's own machine.

Software

Software is the main component of the database management system (DBMS). Basically, with the help of software we can tell the computer what to do, when to do, and how to do.

Software is capable to understand the database language and its help to convert the database into commands so compiler can rum them on a database.

Example of DBMS Software: MySQL, PostgreSQL, SQL Server, Oracle, RDBMS, etc.

Data

  • The word data is a collection of facts. It is the raw material from where we can generate information.
  • In database, we can store data in structure and non- structure or logical way.
  • Using database, we can create the database first after that we can manage that data we can access and update the database easily.

Procedures

  • Procedures refer to the simple instruction to use a database management system. In this, we should know the procedure of managing database.
  • In simple word, procedures are instruction and rules that describe how to use the DBMS.
What is Database
  • It guides the users that operate the database so that we can manage the data in a proper form.

Database Access Language

 Database access language is also known as query language. It is used to access the data from the database so that the user can enter the new data, and also update the data that are available in the database, or we can retrieve the required data from the database.

Types of Databases

There are different types of databases:

  • File-based databases
  • Relational databases
  • Object oriented databases
  • Distributed databases
  • No SQL databases
  • Graph databases
  • Cloud databases

File-based databases

File-based database are first developed in 1968. In this type of database, we can store data as a flat file. It is the simplest database with less security and management.

Relational databases

Relational database data is structured into tables in the form of column and rows. It is most effective and versatile database to access the structured data.

For example: Oracle, MySQL, Microsoft SQL Server, etc.

Object-oriented databases

Object oriented databases are used to represent data in the form of class and object, same as we use in object-oriented programming. In OOPs, we can create member function which shows the attribute of the database class.

Distributed databases

In distributes databases the data is spread in the multiple geographical location so that the data can provide the high availability and quick access to the users.

For Example: Apache ignite, Apache Cassandra etc.

NoSQL databases

In NoSQL database, we can store the data in an unstructured and semi-structured manner. In this type of database, we can't store the data in the form of rows and column.

Graph databases

As a name suggest, in this type of database, we store the data in the form of a graph. In graph database, we have nodes and edges, and each edge denotes the relationship between multiple edges and node represents the objects. In a graph database, every node has a unique identity.

Cloud databases

Cloud databases allow us to store the data over the internet and cloud platform. We also manage and access the data very easily.

For example: AWS (Amazon Web Services), cloud services etc.

 Hierarchical Databases

  • This type of database will store the database in a tree-like structure, which contains the parent-child relationship.
  • In this, we can store and access the relative data more efficiently.
  • It is easy to use. The new information can be easily added or modified without affecting other components of a database.

DBMS language

The language is used to do the different things in a database. Like every language has different functioning some languages can use to insert the data, and some are used to modify the data.

What is Database

So, we have 5 types of languages in SQL:

1. DDL

  • DDL stands for Data Definition Language.
  • The DDL language use to define the structure and the schema of the database.
  • The DDL is also used to create the database as well as to modify the database object.
  • Example: CREATE, DROP, ALTER, TRUNCATE, RENAME.
  • CREATE: This is used to create the attributes which we use in the database.
  • DROP: This is used to delete the data in the table.
  • ALTER: This is used to change the structure of the database.
  • TRUNCATE: This is also used to delete the data in a database but is quite different from DROP.
  • RENAME: This is used to change the name of different database objects.

2. DML

  • The DML stands for Data Manipulation Language.
  • The DML language is used to manipulate the data in the database.
  • It is used to insert, modify, and delete the data inside the database.
  • If you have created the table and you have entered the data in it. If you want to modify or change or delete the data then you can use the DML language.
  • It can manipulate any data which is present inside the database.
  • Examples: INSERT, UPDATE, DELETE.
  • INSERT: it is use to insert the data in into the table.
  • UPDATE: it is used to change the data which is previously present in the database (Updating)
  • DELETE:  it is used to delete the data from the database.

3. DQL

  • The DQL stands for Data Query Language
  • This is used to retrieve the data present in the database.
  • As you know in DDL, we create the structure of the data. In DML, we do the modification in the data. But in the DQL, it is used to show/display the data which is present in the database.
  • You can use various other features like MIN, MAX, AVERAGE, etc.
  • SELECT: It is used to select the particular data from the table.
  • MIN: It is used to select the maximum from the database
  • MAX:  It is used to select the Minimum from the database.
  • AVERAGE: This is used to select the Average from the database.

4. DCL

  • This language is used to control the rights and privileges given to the different users of the database.
  • In this, there is one user which is the admin who has all of the rights related to the database.
  • For example, if there is another user named Rohit, so what he does is that he gives the insertion and modification rights to Rohit so that Rohit can do the modification as well as an insertion in the database.
  • The DCL is used to GRANT and REVOKE the permission to the different users in the database.
  • Example: GRANT, REVOKE
  • GRANT: It is used to give access to the database to the particular user
  • REVOKE: It is used to restrict access to the database to the particular user.

5. TCL

  • This language is used to control all of the transaction which is happening in the database.
  • It means, if you have done some changes in the database then all are controlled by the TCL language.
  • If you have created a table and inserted some data in it, then you have done the modification in that database. If you have deleted the data in that database and you won't save all these changes permanently then these changes are done by TCL.
  • TCL is used to manage the changes which have been done in the database.
  • Example: COMMIT, ROLLBACK, SAVEPOINT.
  • COMMIT: It is used to save the database changes permanently.
  • ROLLBACK: It is used to roll back the changes mean revert the changes.
  • SAVEPOINT: It is used to rollback but in this, we can mention when till you want to rollback. Like you want to rollback by 5 steps then with the help of the save point we can rollback.

Need of the DBMS

In the real world, we have a huge amount of data. We have to store the data in the appropriate format so that it becomes easy to access and fetch that data. In the DBMS, data is stored in the form of the row and column.

Example: If you are storing the school data then it contains Admission id, Roll no, Name, Age, and Gender. So, in the database data is stored in the form of these all attributes.

Controlling redundancy

The word redundancy means duplicate data. This means in the file system there can be the same data available in the files multiple times. But in the database, you cannot store similar data multiple times.

For Example: If an employee is working in the organization, he is HR as well as a Developer also. So, his mobile no, the address stored multiple times one in the developer department as well as in the HR department. It can decrease the efficiency to access the data. The DBMS uses data normalization to avoid data redundancy.

Memory management

The DBMS manages the memory efficiently. It makes complex memory management easy to handle. In the file system, data is stored in the form of an index, so if you want to search the particular data then you need to search each record.

But in the DBMS, you just need to enter the query to access the particular data. The data access rate is faster in DBMS as compared to file system.

Integrity

Integrity means the data which you have entered is correct and authentic. It should not contain any wrong information.

For Example: If you have created the database for the driving license test in that you have to set the condition that you must be at least 18 years. So, DBMS ensures that the data that the user will enter should follow the condition.