Structured Query Language, or SQL, is the standard language used to communicate with a database,
and or change records and user privileges, and perform queries.
There Language, which became an ANSI standard in 1989, is currently used by almost all of today’s commercial RDBMS.
SQL, statements fall into one of three categories.(Types of SQL)
Data Definition Language(DDL) : DDL Consists of statements that define the structure and relationships of a database and its table.
These Statements are used to Create, drop and modify databases and tables.
Data Manipulation Language(DML) : DML statements are related to altering and extracting data from a database.
These statements are used to add records to, update records in, and delete records from, a database; perform queries; retrieve table records matching one or more user specified criteria; and join tables together using their common fields.
Data Control Language(DCL) : DCL statements are used to define access levels and security privileges for a database.
You would use these statements to grant or deny user privileges; assign roles; change passwords; view permissions; and create rulesets to protect access to data.
The Syntax of SQL is quite intuitive. every SQL statement begins with an “action word”, like DELETE, INSERT,ALTER etc.
it ends with a semicolon. whitespace, tabs, carriage returns are ignored.
Some example of valid SQL statements :
CREATE DATABASE emplyee;
SELECT name FROM users where email =”firstname.lastname@example.org”;
DELETE FROM cars WHERE year_of_manufacture < 1980;