Updated: Apr 13
SQL is an acronym for Structured Query Language, a language for dealing with relational databases. So, before going into the depth of SQL, let us understand the concept of databases.
In very simple terms, a database is an organised or systematic collection of data which can generally be stored and accessed from a computer system. Any type of data that is, numeric or non-numeric data can be stored in a database. For example, all the information of the employees of an organisation is stored in the databases because it is easy and convenient to access a database in order to fetch the data.
Database Management System (DBMS):
A database management system is defined as a software or a collection of programs which is used to manage a database. It enables its users to access a database for fetching and manipulating the data. Database management systems can broadly be classified into 2 types:
1. Relational Database Management System (RDBMS)
2. Non- Relational Database Management System
A relational database is the one that incorporates the table/key model unlike a non-relational database. I’ll be focusing on relational databases because SQL can be used only on relational databases whereas the non-relational databases use NoSQL (an acronym for not only SQL).
A relational database comprises of a large number of tables that are related to one another. In this database, each row in the table is a record with a unique ID called the key and the columns of the table hold attributes of the data in the table. Examples of a relational database include MySQL, Microsoft SQL, Oracle etc.
SQL is a language to operate the relational databases. In other words, to access the data from relational databases we need a language and SQL is that language. It helps to fetch the desired data from the database. SQL is an ANSI (American National Standard Institution) standard language. It is used in database creation, deletion, fetching rows, modifying rows etc.
The standard SQL commands to interact with a relational database are:
· Delete and
These commands are classified into the following groups:
1. Data Definition Language (DDL):
As the name suggests, this is for defining the data and comprises of:
· Create: To create a new table or a database.
· Alter: To modify an existing table.
· Drop: To delete an entire table.
2. Data Manipulation Language (DML):
As the name suggests, this is for manipulating the records stored and comprises of:
· Select: To retrieve some records from single or multiple tables.
· Insert: To add or create a record.
· Update: To modify the records.
· Delete: To delete the records.
3. Data Control Language (DCL):
As the name suggests, this is for controlling the access to be granted and comprises of:
· Grant: To grant permission to a user.
· Revoke: To take back granted privileges from a user.
Author: Aditi Langar (https://www.linkedin.com/in/aditilangar/)