Database Reference
In-Depth Information
Example:
SELECT *
FROM emp;
This command will display all the fields of the table emp and all
of the records.
Example:
SELECT ename, sal
FROM emp
WHERE sal > 2000;
The result of this statement will be only two columns of emp
table and only those records where salary is greater than 2000.
Example:
SELECT ename, salary
FROM emp
WHERE sal > 2000
ORDER BY ename;
The output of this statement will be exactly the same as the one
above except that the output will be sorted based on ename
column.
Just like we used the greater than (>) operator in the previous
examples, there are other SQL operator too. They are mostly
used in the WHERE clause to filter certain records (or to reduce
the number of records in the output). “Reduce the number of
records”, what this means? Why we need to reduce the number
of records in the output. Imagine a SSA (Social Security
Administration) office. The database they are having must be
having millions of records in it. You can well realize the
drawback if someone would execute the following statement.
Search WWH ::




Custom Search