In database , Filtering is important. We use some keyword to filter data.
DISTINCT
DISTINCT clause is used to remove the duplicate records from the result set.
It is only used with SELECT statement.
Syntax:
SELECT DISTINCT expressions
FROM tables
WHERE conditions;
Example:
select distinct sname
from students
where student_city = 'Delhi';
WHERE
The WHERE clause specifies a search condition for rows returned by the SELECT statement.
syntax:
SELECT select_list
FROM table_name
WHERE search_condition;
Example:
select *
from students
where student_city = 'Delhi';
AND
It combine two or more Boolean expressions and return true if all expressions are true.
syntax:
expression_1 AND expression_2
Example:
select *
from students
where student_city = 'Delhi' and student_type ='Day Scholar';
OR
It combine two or more Boolean expressions and return true if one of the expressions is true.
syntax:
expression_1 OR expression_2
Example:
select *
from students
where student_city = 'Delhi' or student_type ='Day Scholar';
BETWEEN
It is used filter data based on a range of values.
syntax:
value_1 BETWEEN value_2
Example:
select *
from students
where student_id between 2104 and 2107;
LIKE
Sometimes, you want to query data based on a specified pattern. For example, you may want to find contacts whose last names start with 'St' or first names end with 'er'. In this case, you use the Oracle LIKE operator.
syntax:
LIKE = 'specific pattern'
Example:
NULL / NOT NULL
check if an expression or values in a column is NULL or not.
syntax:
expression | column IS NULL | NOT NULL