SQL Refining Data 


1) SQL Distinct Statement

The select distinct statement use to search unique data from a table.

If two data are same then it show only one data.


Syntax - 

select distinct column_name from table_name;

sql distinct statement

Note:- This statement must have one column name because it shows distinct (unique) value. If you give two column name then it not give unique values as shown in the below figure.

sql distinct statement

2) SQL Order By Keyword 

The order by keyword use to set the data of a table in an ascending or descending order.


Syntax -

select column1_namecolumn2_name...

from table_name

order by column1_namecolumn2_name, ..... asc | desc;

sql order by keyword

Note:- If you do not mention asc or desc then it shows data in ascending (asc) order by default.


3) SQL Limit Keyword

The limit keyword use to search any data from the column with any limitation.


Syntax -

select * from table_name limit range;

sql limit keyword