SQL is a standard language for accessing and manipulating databases. It includes database creation, deletion, fetching rows and modifying rows etc. SQL is stands for Structured Query Language.
SQL is an ANSI (American National Standards Institute) standard but there are many different versions of the SQL language.
SQL is the standard database language for Relation Database System like MySQL, MS Access, Oracle, Sybase, Informix, postgres and SQL Server etc. The data in RDBMS is stored in tables. A table is a collection of related data entries in the form of columns and rows.
The SQL language has several parts:
- Data Definition Language (DDL)
The SQL DDL provides commands for defining relation schemas, deleting relations, and modifying relation schema.
|CREATE|| Creates a new table, a view of a table, or other object in database|
|ALTER|| Modifies an existing database object, such as a table.|
|DROP|| Deletes an entire table, a view of a table or other object in the database.|
- Data Manipulation Language (DML)
The SQL DML includes a query language based on both the relational algebra and the tuple relational calculus. It includes also commands to insert tuples into, delete tuples from, and modify tuples in the database.
|SELECT|| Retrieves certain records from one or more tables|
|INSERT|| Creates a record|
|UPDATE ||Modifies records|
|DELETE|| Deletes records|
- Data Control Language (DCL)
It provides commands to control access to data stored in a database.
|GRANT|| Gives a privilege to user|
|REVOKE|| Takes back privileges granted from user|