SQL For Beginners - Introduction

SQL stands for Structured Query Language. SQL is a language which helps us to work with the databases. Database do not understand English or any other language. Just as to create software, we use Java or C#, in the similar way to work with databases, we use SQL. SQL is the standard language of Database and is also pronounced as Sequel by many people.

In my previous article "Introduction To DBMS", I mentioned that DBMS allows us to create databases, maintain databases, retrieve data, analyze data, etc. But, how exactly DBMS allows us to achieve all this functionality? The answer is SQL.

SQL is a language which allows you to define, manipulate and retrieve data from relational databases. Relational Databases are the databases which store data in the form of objects (like tables) which may be related to each other.

The diagram below displays a relation (table) and its components.

RDBMS

Table in RDBMS

SQL allows us to create such tables, insert data, delete data, view data from such tables and much more. The table is made up of rows (tuples) and columns (domains). Column headings are also called Attributes. A field is a basic building block of the table. A record is the horizontal row of data.

SQL COMMANDS

SQL Language is made up of various types of SQL Commands. The SQL language commands are divided into four main sections:

  1. DML (Data Manipulation Language) Commands:

    - DML commands are used to insert, update and delete data in the database. As the name suggests, they are used to manipulate the data in database.

    - The DML commands are INSERT, UPDATE and DELETE.

  2. DDL (Data Definition Language) Commands:

    - DDL commands are used to manipulate the database itself. They deal with creation of database, altering it's structure and deleting the database.

    - The DDL Commands are CREATE, ALTER and DROP.

  3. DCL (Data Control Language) Commands:

    - DCL commands are used to control the access to the database. They are used to give privilege to the users and take away privilege from the users.

    - The DCL Commands are GRANT and REVOKE.

  4. DQL (Data Query Language) Command:

    - Data is accessed from the database by firing queries. DQL command allows us to fire queries to the database and get the data from the database.

    - The DQL command is SELECT.

We will learn about each of these commands in detail in the upcoming series of articles. Stay tuned. Happy Learning!