SQL and its basic commands

Ankit Kumar Gupta
TEK Society
Published in
4 min readFeb 21, 2021

What is SQL?

SQL stands for Structured Query Language, a programming language used for storing, manipulating and retrieving data that is stored in a relational database.

SQL is popularly known as the standard language for the Relational Database. The Relational Database Management Systems (RDMS) for example Oracle, MySQL, MS Access, and obviously the SQL server makes use of the SQL as the database language.

MySQL

MySQL is an open-source RDBMS software written/developed in C and C++.

In actual an RDBMS helps us to organise our data into one or more than one table, where a relationship exists between the data and their types. The structure of the data is maintained through these relations between the data.

SQL COMMANDS

The following ways are used to manipulate the data and information stored in the database.

✏ DDL: Data Definition Language: This involves the properties such as creation, deletion, altering of data and etc in the structure of the table.

The changes made here are permanent and do not differ when they are saved and when there is any requirement of this particular data.

The various DDL commands are:

  1. create- for creating a new table/database.
  2. rename- for renaming a table.
  3. drop- dropping a table.
  4. alter- any alteration on the database.
  5. truncate- data deletion from the table

✏ DML: Data Manipulation Language: These commands are involved in the manipulation of the stored data / saved data in the table.

These manipulations aren't permanent i.e, we can always get back to the previous version of the data on which our manipulations were performed.

The various DML commands are:

  1. insert- command for inserting a new row in the table.
  2. merge- used for merging two rows. We also can merge two tables
  3. delete- for row deletion.
  4. update- for updating any manipulated row in a table.

✏ DCL: Data Control Language: The Data Control Language has the potential & importance to provide access /control to the database. This is used as the security for the data in the database, as only the owner can grant and revoke control to the data.

The various DCL commands are:

  1. grant: to give users access to the database.
  2. revoke: to deny /restrict the permission to access the database.

✏ TCL: Transaction Control Language: These commands are used to observe the actions and alteration of the other SQL commands in the database. Briefly speaking; these commands have the potential to revert back any unnecessary or corrective manipulations in the database.

The various TCL commands are:

  1. rollback: This command helps to restore the data to the last/previous committed state in the database.
  2. commit: This command saves a particular transaction permanently in the database, indicating a successful processing of that transaction with its details.
  3. savepoint: This command saves the transaction details temporarily in the database and we can rollback to it whenever required as per our need.

The next post would contain the description and uses of the above commands and SQL query approach.

For more such posts, do follow our Publication :
https://medium.com/tek-society

If you loved my work do help me with a clap👏 as it would boost my enthusiasm and love for posting more such briefs which would help you to mount up your knowledge.

~~Thank you.

--

--