Introduction

SQL is a language that enables you to work with a database. Using SQL, you can insert records, update records, and delete records. You can also create new database objects such as databases and tables. And you can drop (delete) them. SQL is not case sensitive. It is divided into below main categories

  • DML (Data Manipulation Language)
  • DDL (Data Definition Language)
  • DCL (Data Control Language(DCL)

Data Manipulation Language

DML enables you to work with the data that goes into the database. DML is used to insert, select, update, and delete records in the database. Many of your SQL statements will begin with one of the following commands:

  • SELECT – Retrieves data from the database
  • INSERT – Inserts new data into the database
  • UPDATE – Updates existing data in the database
  • DELETE – Deletes existing data from the database

Data Definition Language

You may also occasionally need to create or drop a table or other database object. SQL enables you to do this programmatically using DDL. Examples of DDL commands:

  • CREATE DATABASE – Creates a new database
  • ALTER DATABASE – Modifies the database
  • DROP DATABASE – Drops (deletes) a database
  • CREATE TABLE – Creates a new table
  • ALTER TABLE – Modifies the table
  • DROP TABLE – Drops (deletes) a table

Data Control Language

DCL is used to control privileges in Database. To perform any operation in the database, such as for creating tables, sequences or views, a user needs privileges. In DCL we have two commands,

  • GRANT: Used to provide any user access privileges or other privilege for the database.
  • REVOKE: Used to take back permissions from any user.

Reference

SQL