Structured Query Language (SQL) is a non procedural language used for retrieving data from the queries. It was introduced by IBM as a part of R project. It was declared as a standard language by ANSI and ISO.
It has subcategories:
- DDL or Data Definition Language has commands like create, rename, alter.
- DML or Data Manipulation Language has commands like update, insert, delete.
- DCL or Data Control Language has commands like grant and revoke.
- TCL or Transaction Control Language has commands like rollback, commit.
Data Manipulation Language has a subcategory:
Data Query Language (DQL) or Data Retrieval Language (DRL). Data Query Language has commands that retrieve the data from the query. It has a single command: select.
Characteristics of DQL:
It is used for retrieving data. A user can retrieve data according to his/her requirements using select command.
If a user want to retrieve all the from the employee table, the query must be given as follows:
select * from employee;
asterisk mark (*) indicates that all the rows is retrieved from the table.
If a user want to know the average salary of the employees, the query must be given as follows:
select avg(salary) from employee;
This displays the average salary of the employees.
Here asterisk mark isn’t needed as we need to retrieve only particular rows.
If a user wants to know the name of the employee whose salary is less than 10, 000;the query is:
select ename from employee where salary<=10, 000;
A condition is placed to retrieve the data and a relational operator is used as well.
- select is a standard command used for almost every query.
- It can also be written as SELECT as SQL is a case insensitive language.
- It makes the data retrieving process more easier.
- Data Query Language has no disadvantages.
- It is not possible to imagine Structured Query Language without the select command.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.