SQL Data Retrieval Language / Data Selection Language

Introduction to DRL/DSL

  • DRL/DSL stands for Data Retrieval Language/Data Selection Language.
  • It is a set commands which are used to retrieve data from database server.
  • It manipulates the data in database for display purpose like aggregate function.
  • In DRL/DSL, for accessing the data it uses the DML command that is SELECT.
  • The SELECT command allows database users to retrieve the specific information they desire from an operational database.
SELECT clause has many optional clauses are as follow;

ClauseDescription
FROMIt is used for selecting a table name in a database.
WHEREIt specifies which rows to retrieve.
GROUP BYIt is used to arrange the data into groups.
HAVINGIt selects among the groups defined by the GROUP BY clause.
ORDER BYIt specifies an order in which to return the rows.
ASIt provides an alias which can be used to temporarily rename tables or columns.

Syntax:
SELECT {* | column_name1, column_name2, . . . , column_name_n}
FROM <list_of_tablename>
WHERE <condition>;

Example

SELECT * FROM employee
WHERE salary >=10000;

OR

SELECT eid, ename, age, salary
WHERE salary >=10000;