Академический Документы
Профессиональный Документы
Культура Документы
If you want to see only employee names and their salaries then you can type the following
statement
To see those employees whose salary is less than 5000 then the query will be
Logical Conditions
A logical condition combines the results of two component conditions to produce a single
result based on them or to invert the result of a single condition. Table below lists logical
conditions.
Membership Conditions
A membership condition tests for membership in a list or subquery
Null Conditions
A NULL condition tests for nulls.
What is null?
If a column is empty or no value has been inserted in it then it is called null. Remember 0 is
not null and blank string ‘ ’ is also not null.
EXISTS Conditions
An EXISTS condition tests for existence of rows in a subquery.
LIKE Conditions
The LIKE conditions specify a test involving pattern matching. Whereas the equality operator
(=) exactly matches one character value to another, the LIKE conditions match a portion of
one character value to another by searching the first value for the pattern specified by the
second. LIKE calculates strings using characters as defined by the input character set.
For example you want to see all employees whose name starts with S char. Then you can use
LIKE condition as follows
Similarly you want to see all employees whose name ends with “d”
You want to see all employees whose name starts with ‘A’ and ends with ‘d’ like ‘Abid’,
’Alfred’, ’Arnold’.
SQL>select * from emp where ename like ‘A%d’;
You want to see those employees whose name contains character ‘a’ anywhere in the string.
To see those employees whose name contains ‘a’ as last second character.
To see those employees whose name contain ‘%’ sign. i.e. ‘%’ sign has to be used as literal
not as wild char.
SQL> select * from emp where ename like ‘%\%%’ escape ‘\’;