Home Videos Exercises MCQ Q&A Quiz Services Sign in

Introduction of SQL

SQL stands for structured query language, it is used to manage database.


What is SQL?

SQL stands for structured query language, it is used to manage database.

SQL was originally developed by Raymond Boyce and Donald Chamberlain at IBM in 1970.


Features of SQL

  • Data modification with ease.
  • Data integrity and constraints.
  • Joining tables for comprehensive insights.
  • Aggregation and grouping.
  • Sorting data for analysis.
  • Subqueries for complex queries.
  • Data security and access control.
  • Transaction management.

Sql Commands

SQL commands are instructions. It is used to communicate with the database. It is also used to perform specific tasks, functions, and queries of data.

SQL can perform various tasks like create a table, add data to tables, drop the table, modify the table, set permission for users.


Types of SQL Commands

There are five types of SQL commands: DDL, DML, DCL, TCL, and DQL.


Data Definition Language (DDL)

DDL changes the structure of the table like creating a table, deleting a table, altering a table, etc.
All the command of DDL are auto-committed that means it permanently save all the changes in the database.


Here are some commands that come under DDL:

  • CREATE
  • ALTER
  • DROP
  • TRUNCATE

Data Manipulation Language (DML)

DML commands are used to modify the database. It is responsible for all form of changes in the database.
The command of DML is not auto-committed that means it can't permanently save all the changes in the database. They can be rollback.


Here are some commands that come under DML:

  • INSERT
  • UPDATE
  • DELETE

Data Control Language (DCL)

DCL commands are used to grant and take back authority from any database user.


Here are some commands that come under DCL:

  • Grant
  • Revoke

Transaction Control Language (TCL)

TCL commands can only use with DML commands like INSERT, DELETE and UPDATE only.

These operations are automatically committed in the database that's why they cannot be used while creating tables or dropping them.

Here are some commands that come under TCL:

  • COMMIT
  • ROLLBACK
  • SAVEPOINT

Data Query Language (DQL)

DQL is used to fetch the data from the database.

It uses only one command.

  • select

The Most Important SQL Commands

  • SELECT - extracts data from a database
  • UPDATE - updates data in a database
  • DELETE - deletes data from a database
  • INSERT INTO - inserts new data into a database
  • CREATE DATABASE - creates a new database
  • ALTER DATABASE - modifies a database
  • CREATE TABLE - creates a new table
  • ALTER TABLE - modifies a table
  • DROP TABLE - deletes a table
  • CREATE INDEX - creates an index (search key)
  • DROP INDEX - deletes an index