Introduction to DBMS (MySQL)

intro DBMS

Hey guys, In this blog I am sharing some basics of Database Management System. as you all know that data play a very pivotal role in any business formation. these days each and every aspect of any business depends on data, as a result, the management of data has also become a crucial part of any business. In the software OR IT industry, we use database management tools for storage and management of data. there are several DBMS available to manage lots and lots of data like Oracle, MySQL, MS SQL, MongoDB etc. So, in this post, we will learn some very basic concepts of DBMS point by point.

  • To run any business the basic component is data. Data is nothing but the collection of raw facts, which doesn’t have any meaning.
  • When we processed data we get the information. We input raw data in the computer, the computer processed the data and give out the meaningful information.E.g

My is sachin name (data)
My name is Sachin (information)

  • We (user) store data in the database.
  • as we know we store data in the database but the fact is we cant store OR fetch data automatically.
  • Because data is stored in millions of hard disks in a database center, we can not access these databases directly. For this, we need a management system (a software) known as database management system(DBMS).
  • DBMS stand for database management system.
  • DBMS allows the user to access data by using the language called SQL.
  • Before computers came, people used to store/manage data in the files known as file management system. After the arrival of computers, we are using the database to store/manage data. which is known as database management system
  • There are different types of database management system

E.g.

NDBMS

HDBMS

ODBMS

RDBMS

  • The most popular in the market is RDBMS.
  • RDBMS stands for relational database management system.
  • In RDBMS data stored in tables which are having relationships.
  • Some examples of RDBMS are –

Oracle

Microsoft SQL server

MySQL

  • We will study MySQL.
  • According to ANSI, MySQL is the standard language to deal with relational database management.
  • SQL stands for Structured Query Language.
  • SQL is the language used to communicate b/t the user and the database.
  • There are different languages (sub-languages) inside the SQL itself. These are –
DDL (data definition language) create, alter, drop, truncate
DML (data manipulation language) insert, update, delete
DRL/DQL (data retrieval language) select
DCL (data control language) grant, revoke
TCL (transaction control language ) commit, rollback, savepoint

As we are learning RDBMS, the data stored in tabular form. So we have to understand what is a table.

E.g.

ID Name
1 Sachin
2 Aman
3 Atul

Above is a basic table which has two parts one is the structure OR metadata OR definition of the table and the other part is data itself. When we have both the parts we call it a complete table.

  • To work on the definition part we use DDL (data definition language)
  • To work on the data part we use DML (data manipulation language)
  • We can work on both the parts by DRL (select command)
ID Name
1 Sachin
2 Anil ()

We will see the working of all the commands in the below examples

DDL commands :

Create: to create the table.

INPUT: Create table student ( ID int, Name varchar (10) )

OUTPUT :

ID Name (10)

Alter: to alter the structure of the table. In the example, we’ll add a new column to the table.

INPUT: alter table student add F_name varchar (20)

OUTPUT :

ID Name(10) F_name(20)

Now, we want to drop the name column.

INPUT: alter table student drop column Name

OUTPUT :

ID F_name(20)

As far we have only added OR removed a column form the structure. We can also modify the structure of the table. In the below example we’ll change the data type of the F_name field from varchar to char of 20.

INPUT: alter table student alter column F_name char (20)

Drop: via drop, we can delete the entire table from the database.

INPUT: drop table student

OUTPUT: This will delete the student table from the database.

Truncate: this command is used to truncate the data.

Leave a comment