Introduction to SQL
Structured Query Language (SQL) is a standard database language used to manipulate relational database. It can be be pronounced as S-Q-L or "sequel". However, in Microsoft and Oracle, it is more often pronounced as "sequal", while in DB2 and MySQL environment, it is more commonly pronounced as S-Q-L. SQL is used in most relational database management system, including Microsoft Access, Microsoft SQL Server, IBM DB2, Oracle, Sybase, Informix, Ingres and many others.
American National Standards Institute (ANSI) and International Organization for Standardization (ISO) had worked together to standardize SQL so that all database systems can exchange data by passing SQL request and response to each other. Although most of the relational database management system in the market can be manipulated using the standard SQL, many database vendors extend the standard SQL with their specific code to add more capabilities to the database system. Furthermore, most of the database management systems were developed before the standardization by ANSI/ISO. Thus, expression of SQL in different databases may differ a bit from each other.
Also take note that SQL is not a programming language. SQL is a database query language. It cannot be used to build a a complete application. You need to use SQL in combination with other programming language in order to build a complete application. Although SQL is not a programming language, but it offers all the commands that you need to create, modify and maintain relational database. SQL comprises of three major components:
-
Data Definition Language (DDL)
-
Data Manipulation Language (DML)
-
Data Control Language (DCL)
Data Definition Language (DDL)
Data Definition Language is the part of SQL that used to create database, modify database structure and destroy unwanted database. You use DDL to create the basic elements of the database such as tables, schemas, views and clusters. DDL only involve in creating, modifying and destroying databases and database objects. It does not deal with data. SQL statements that use commands such as CREATE, ALTER and DROP are considered as DDL.
Data Manipulation Language (DML)
Data Manipulation Language (DML) is the part of SQL that insert, retrieve, modify and delete data contained in database. The most common DMLs are SELECT, INSERT, DELETE and UPDATE. These statements can be simple or complex depending on your usage. Please take note that SELECT command can also be separate out as Data Query Language (DQL).
Data Control Language (DCL)
Data Control Language (DCL) give protection to your database from being corrupted. It provides security and data integrity to your database. The amount of protection is depending on your usage and implementation. There are four commands in DCL: GRANT, REVOKE, ROLLBACK and COMMIT. These command protect your database from harm and threat either intentionally or accidentally.