Range searching
SQL> Select * from t1 where sal not between 300 and 500;
Distinct
Syntax:
SELECT DISTINCT column_name(s) FROM tablename;
If you need to find the unique departments and salaries from EMP table then, issue the following query:
SQL> SELECT DISTINCT deptno, sal FROM emp;
Pattern matching
In order to select rows that match a particular character pattern we use the LIKE operator. This character matching operation is called as wildcard search. The following symbols are used for matching the pattern
% (percentage) This symbol represents any sequence of zero or more characters . __ (underscore) this symbol is used for any single character search. The % and _ symbols can be used in any combination with literal characters.
Pattern matching symbol
%(percentage):- represents any sequence of zero or more characters.
_ (underscore):- it is used for any single character search.
List th
e employee names and empno whose names start with J.
SQL> select ename, empno from emp where ename like ‘J%’;
List the employee names whose names are of six characters length.
SQL>select ename from emp where ename like ‘_ _ _ _ _ _ ‘;
. List the employee names whose names end with ‘H’.
SQL>select ename from emp where ename like ‘%H’;
Truncating tables
It works same as delete function.
Syntax:
Truncate table tablename;
Wednesday, October 10, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment