SQL stands for Structured Query Language.
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.
More advanced features include creating stored procedures (self contained scripts), views (pre-made queries), and setting permissions on database objects (such as tables, stored procedures, and views).
Although SQL is an ANSI (American National Standards Institute) standard, there are many different versions of SQL. Different database vendors have their own variations of the language.
Having said this, to be in compliance with the ANSI standard, they need to at least support the major commands such as DELETE, INSERT, UPDATE, WHERE etc. Also, you will find that many vendors have their own extensions to the language – features that are only supported in their database system.
SQL is divided into two following categories:
Data Manipulation Language (DML)
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:- This Sql Statement is used to extract the data from one or combination of tables.
- UPDATE:- This Sql Statement is used to update the data in a database table.
- DELETE:- This Sql Statement is used to delete data from the database table.
- INSERT:- This Sql Statement is used to insert data into a database(table)
Data Definition Language (DDL)
- CREATE TABLE:- This Sql Statements is used to create a Table
- ALTER TABLE:- This Sql Statement is used to Alter the table definition like adding any columns or deleting any table column.
- DROP TABLE:- This Sql Statement is used to Drop the table.
- CREATE INDEX:- This Sql Statement is used to Create a Index on a table
- DROP INDEX:- This Sql Statement is used to drop a table from the table
- CREATE DATABASE – This Sql Statement is used to create a new database
- ALTER DATABASE – This Sql Statement is used to modifie the database
- DROP DATABASE – This Sql Statement is used to drop (delete) a database
Data Control Language
It is used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it.
- GRANT:- This Sql Statement is used to give access rights to the user for the database.
- REVOKE:- This Sql Statement is used to revoke or delete the access rights of some of the users for a given database.
Transactional Control Language
It is used to manage different transactions occurring within a database.
- COMMIT:- This command is used to save the work done by the user.
- ROLLBACK:- This command is used to delete the data till the last committed state of the database.