SQL (Structured Query Language) is a computer language used for storing, manipulating and retrieving data stored in a relational database system (RDBMS).
Examples: MySQL, MS Access, Oracle, Sybase, Informix, Postgres, and MS SQL Server
There are different dialects of SQL:
MS SQL Server uses T-SQL,
Oracle uses PL/SQL,
MS Access uses JET SQL
Advantage of SQL
- Allow users to access data in relational database management systems.
- Allow users to describe data.
- Allow users to define data in database and manipulate that data.
- Allow to embed SQL in other languages (php)
- Allow users to create and drop databases and tables.
- Allow users to create view, stored procedure, functions in a database.
- Allow users to set permissions on database, tables, fields, procedures, and views
SQL statements are divided into four major categories:
DDL (Data Definition Language)
DDL statements are used to build and modify the structure of database tables and other objects in the database.
CREATE DATABASE School
CREATE TABLE Students ...
CREATE INDEX ...
ALTER TABLE Students ...
DROP TABLE Students
DML (Data Manipulation Language).
DML statements are used to manupulate data in tables.
INSERT INTO students ...
UPDATE students ... records
DELETE students ... records
DCL (Data Control Language)
Grant (permissions)
Revoke (permission)
TCL (Transaction Contol Language)
Rollback
Commit