Skip to content

DQL Commands

DQL statements are used for performing queries on the data within schema objects. The purpose of the DQL Command is to get some schema relation based on the query passed to it. This command allows getting the data out of the database to perform operations with it.

SELECT

The SELECT statement is used to retrieve data from a database. The data returned is stored in a result table, called the result-set.

  • select data from any Column:
SELECT column1, column2, ...FROM table_name;
  • select all the Columns:
SELECT * FROM table_name;
  • To return only distinct (different) values:
SELECT DISTINCT columnname FROM table_name;
  • When we want to count the columndata:
SELECT COUNT(DISTINCT columnname) FROM table_name;