Skip to main content

SQL --- Structured Query Language

SQL by QDS

 

What is SQL?

Structured Query Language is also known as SQL is the database language and is one of the most famous and in-demand technology.  This language was specially developed for database management i.e. creating a database, inserting and updating records in them, managing accesses and retrieving data from it. SQL is mostly used for Relational Database Management Systems. 

Its demand is increasing every single day. As there is an increase in data, demand and need for SQL increases. It is been used by web developers, data analysts, data engineers, and in every other field where we need to store and retrieve data. 

One of the main reasons why SQL is gaining popularity is that it is simple, easy, quick, and powerful. Another reason is that the most commonly used version of SQL(MySQL) is open-source(FREE)

Another great feature of  SQL is Non Procedural language(explained in the next section). 

Why SQL?

Now, we may ask why do we need SQL? Why should we learn it..!!! 

It is so because:- 

  • It is the most widely used language ie. from Web Development to Data Analytics
  • It has been on the list of most famous programming languages for the last 5 years.
  • It is a highly in-demand language.

The key feature that makes it different from the other languages is that it is a non-procedural language and it is Quick and Easy to learn.

Procedural..!!! What's that...!!! 

Procedural is a type of programming language that focuses on doing a task in a well-defined manner with proper steps and structure. Eg:- Java, C etc. 
These languages have a well-defined structure and need to be very specific while doing a task. So here the focus is more on the steps and procedure "How to do" rather than the task itself "What to do".

On the other Non-Procedural is just the opposite of the above, it focuses on the task itself "What to do" rather than "How to do". In this we do not need to focus on the steps and structure rather we simply ask the system to do a particular task. Eg:- SQL, LISP etc.

I would like to explain this with a quick example: "Ask a Dog to fetch the ball".  

Procedural Vs Non-Procedural
Procedural Vs Non-Procedural

Hope that makes it clear the difference between Procedural and Non-procedural language.

It's time to move ahead with the SQL and look into the different components of SQL.

Components of SQL

The SQL commands are grouped into 4 major components as per their usage, these components are:- 

Let's dive deeper into these components and learn about them. 

Data Definition Language:-  DDL is also referred to as Data Description Language by some of the experts as the language/syntax is used for creating and modifying databases including the tables. Its purpose is to create a database, describe a database, modify it and provide a structure for storing the data. The main commands used for this are:- 

  • CREATE
  • RENAME
  • DROP
  • TRUNCATE
  • ALTER
Data Manipulation Language:- DML is used for manipulating the database, i.e inserting the data in the database, updating the data, fetching the data and deleting the data. It is the most commonly used language as it provides the most basic functionalities of SQL. The main commands used in this are:- 
  • SELECT
  • UPDATE
  • DELETE
  • INSERT
  • EXPLAIN
Data Control Language:- DCL is not a common language, it is mostly used by the database administrators for managing access to the users. It has only the following 2 commands:-
  • GRANT
  • REVOKE
Transaction Control Language:- TCL is mainly used for managing the transactions in a session, they are used for instructing the database to save or revert the changes. The commands used here are:- 
  • COMMIT
  • ROLLBACK
  • SAVEPOINT
  • SET TRANSACTION
SQL Components
SQL Components


Summary

Let's have a QUICK recap of what we have learned here...

We learned about the basics of SQL, its definition, why it is important and what are the components used in SQL. 

We also had a look at different programming methods i.e Procedural and Non-Procedural there are differences with an EASY example.

That's all from this article. Follow us for more interesting and data science topics explanation Quickly and Easily. 

Comments