Page 7 - Simple Queries in SQL
P. 7
NULL Values
NULL values
select * from employee
where comm is NULL;
select * from employee
where comm is NOT NULL;
Simple calculations
Display of simple calculations
Select ename, sal+comm
from employee
where comm is not NULL;
Displaying Annual salary of dept 20
select ename, sal*12
from employee
where deptno=20;
COLUMN alias
Select ename NAME, sal*12 "ANNUAL SALARY"
from employee;
OR
Select ename NAME, sal*12 AS "ANNUAL SALARY"
from employee;
PATTERN Matching
Pattern matching
% matches any substring (0 onwards)
_ matches exactly one character (no zero even)
select * from emp
where ename like 'A%';
select * from emp
where ename like '_ _ E%';