Now consider we created a database for an application, but how would you retrieve data from the tables. SQL (Structured Query Language) is a standard language designed for managing data in relational tables. This language is used by all the relational database systems. SQL allows users to create databases, add data, modify, maintain data and fetch selected data. It is governed by standards maintained by ISO (International Standards Organization).
Benefits of SQL:
- SQL Is non procedural, that means you do not need to write lengthy programs to get data, there are commands, expressions and operators to use to get data from tables.
- SQL Is portable, databases using sql can be moved from one device to another without any problems.
- Easy to learn as SQL is in form of ENGLISH statements.
Consider the example of the data entered through the website, you have to retrieve the data like your profile details using the username, then the sample SQL that can be used would be
SELECT * FROM wb_Profile_table
Where username = entered_username;
Thus SQL commands can be used to create databases, edit data in the tables, delete data and maintain data in the tables.
SQL commands are classified into 3 groups:
1. DDL(Data definition Language)
DDL includes commands related to creation and deletion of databases and tables.
- CREATE
- ALTER
- DROP
2. DML(Data Manipulation Language)
DML includes commands related to creation, editing and deletion of records in tables.
- SELECT
- INSERT
- UPDATE
- DELETE
3. DCL(Data control Language)
DCL includes commands through which the user control can be maintained.
- GRANT
- REVOKE