Table of Contents

DB Oracle

Commands

oracle$ sqlplus / as sysdba Login to DB if you know root passwd.

Select

select * FROM <table_name> WHERE
lower(<column_name>) LIKE '%substring%';
Search for substring in column column_name:
- lower(column_name) … transfer all strings to lower case
select count(*) from <tables_name> Display sum of all rows.
select * from <table_name>
where lower(<column_name>) like '%rusko%' and rownum>'120000;'
Display rows which are bigger then 120 000 and contain string “rusko”.
select * from <table_name> lower(<column_name_1>) like
'%substring_1%' and <column_name_2> like '%subsrting_2%';
Display rows which met the criterias.
select t.<column_name_1>,t.<column_name_2>
from <table_name> t where t.<column_name_1>
in(string1, string2, string3);
Display rows which contain string1 - string3 in <column_name_1>. The sign “t” is substitut for table <table_name>.

Wildcards

SQL wildcards can substitute for one or more characters when searching for data in a database.

SQL wildcards must be used with the SQL LIKE operator.

With SQL, the following wildcards can be used:

Wildcard Description
% A substitute for zero or more characters
_ A substitute for exactly one character
[charlist] Any single character in charlist
[^charlist]
[!charlist]
Any single character not in charlist
Navigation
Print/export
Toolbox