SQL is a language which is used to interact with relational database management system.
Before we learn what is a SQL and what we can do with the SQL, lets learn the basics first.
What is a database
Database is a organized collection of data. For example a database of a college would be having a collection of data such as –
1. Personal records of Students
2. Students performance history
3. Teachers data
4. Financial department data etc.
Database Management System (DBMS)
A database management system is a software application which is used for managing different databases. It helps us to create and manage database. With the help of DBMS we take care following tasks –
1. Data Security
2. Data Backup
3. Manages huge amount of data
4. Data export & import
5. Serving multiple concurrent database requests
6. Gives us a way to manage the data using programming languages.
To learn more about DBMS, refer this guide – DBMS Tutorial.
Types of Databases
There are two types of databases –
1. Relational Database
2. Non-relational Database
We cannot interact with non-relational databases using SQL.
In relational database, data is organized in form of tables. A table contains rows and columns of data. Table has a unique key to identify each row of the table.
SQL is used to interact with relational databases. We often refer relational database as SQL database.
What is SQL?
1. SQL stands for Structured Query Language, which is a standardised language for interacting with RDBMS (Relational Database Management System). Some of the popular relational database example are: MySQL, Oracle, mariaDB, postgreSQL etc.
2. SQL is used to perform C.R.U.D (Create, Retrieve, Update & Delete) operations on relational databases.
3. SQL can also perform administrative tasks on database such as database security, backup, user management etc.
4. We can create databases and tables inside database using SQL.
Types of Structured Query Language(SQL)
In the above section, we learned what we do with the database using SQL. SQL is basically combination of four different languages, they are –
DQL (Data Query Language)
DQL is used to fetch the information from the database which is already stored there.
DDL (Data Definition Language)
DDL is used to define table schemas.
DCL (Data Control Language)
DCL is used for user & permission management. It controls the access to the database.
DML (Data Manipulation Language)
DML is used for inserting, updating and deleting data from the database.
What is a Query
A Query is a set of instruction given to the database management system, which tells RDBMS what information you would like to get from the database.
Note: Do not worry about learning the queries now, this is just an introduction. We will learn how to write queries in detail in the next tutorials.
For e.g. to fetch the employee name from the database table EMPLOYEE, we write the SQL Query like this:
SELECT employee_name from EMPLOYEE;