Today I am talking about another Select Statement.That is
Select DISTINCT Statement.
The
SELECT DISTINCT statement is used to return only distinct
(different) values.
Inside a table, a column often contains many duplicate values; and sometimes you
only want to list the different (distinct) values.
The
SELECT DISTINCT statement is used to return only distinct (different) values.
The statement look like :
SELECT DISTINCT column1, column2, column3,.....
FROM table_name;
Select statement likely : SELECT column1, column2, column3,.....
FROM table_name;
For example I am showing you both of two queries. Hope it will help you to clear the concept.
Difference between Select and Select DISTINCT :
By using Select statement we get all the value if have any duplicate values in a table. On the other hand Select DISTINCT statement gives only single values.It's remove duplicate values.
Query's are like: SELECT Column name FROM table name;
and SELECT DISTINCT Column name FROM table name;
Now I am describing another condition. It is known as Where Clause. It is usually used as a condition in any SQL statement. Basically used to filter records.Where Clause is used with SELECT , UPDATE ,DELETE Statement as a condition.
Query as like : SELECT column1, column2, ... FROM table_name WHERE condition;
In Where Clause we need to used some operators with its.They are Given below :
|
|
|
|
Operator |
Description |
= |
Equal |
<> |
Not equal. Note: In some versions of SQL this operator may be written
as != |
> |
Greater than |
< |
Less than |
>= |
Greater than or equal |
<= |
Less than or equal |
BETWEEN |
Between an inclusive range |
LIKE |
Search for a pattern |
IN |
To specify multiple possible values for a column |
|
|
|
|
|
|
|
|
| I also give here another example for understand the usage of different Operations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Comments
Post a Comment