Author: Awais Farooq
-
ORACLE Subqueries
In Oracle, subqueries are the queries inside a query. Subqueries can be made using WHERE, FROM or SELECT clause. Table 1: employee1 Table 2: employee2 Example 1 Query: Select name, city from employee1 where id in (select id from employee2 where designation=’Shareholder’) Example 2 Query: Select e.id, e.city, e.name, e1.designation from employee1 e join employee2 e1 on…
-
ORACLE OR
In Oracle, the OR operator is used to check more than one condition and returns the result when any one of the given condition is true. Syntax Parameters condition1, condition2, condition_n : returns the record if any one condition is true. Example 1 Select *from table1 where name like ‘s%’ or age > 20 Example 2…
-
ORACLE NOT condition
In Oracle, NOT condition is used with SELECT, INSERT, UPDATE or DELETE statement. It is also called NOT operator. It is used to negate the given condition. Syntax Parameters Condition: condition to be neglected. Table: Example 1 Query: select *from table1 where name not like 26 Example 2 Query: select *from table1 where name not like ‘s%’
-
ORACLE LIKE CONDITION
In oracle, like condition is used with select, insert, update, and delete in where clause using wildcard. It allows pattern matching. Syntax Parameters expression: name of column. pattern: patter to be matched in expression. Pattern can be in one of the following:- Wildcard Explanation % Used for matching string _ Used for matching single character Table 1:…
-
ORACLE NULL
In oracle, IS NULL is used to check not null values. It is used with select, insert, update, and delete statements. Syntax Parameters expression: column name or any value to check it is a null value Note: Table: Example 1 Query: select * from table1 where name is null
-
ORACLE IS NOT NULL
In oracle, IS NOT NULL is used to check not null values. It is used with select, insert, update, and delete statements. Syntax Parameters expression: column name or any value to check it is a not null value Note: Table: Example 1 Query: select * from table1 where name is not null
-
Oracle INTERSECT Operator
In Oracle, INTERSECT Operator is used to return the results of 2 or more SELECT statement. It picks the common or intersecting records from compound SELECT queries. Syntax Parameters 1) expression1, expression2, … expression_n: It specifies the columns that you want to retrieve. 2) table1, table2: It specifies the tables that you want to retrieve records from.…
-
ORACLE IN
In Oracle, In clause is used with SELECT, INSERT, UPDATE, or DELETE statement to decrease the use of multiple OR conditions. Syntax Parameters Expressions: name of the column for getting value. Table: Example 1 Query: select *from table1 where name in (‘shristee’, ‘dolly’, ‘sid’)
-
ORACLE EXISTS
In Oracle, exists clause is used with select, insert, update, delete statements. It is used to combine the queries and creating subquery. Syntax Parameters subquery: It is a select statement which returns at least one record set. Table 1: Table 1: Example 1 Query: select name from table1 where exists (select *from table2 where table1.id=table2.id) Example 2…
-
Comparison operators
In Oracle, Comparison operators are used with the where clause. The following are the operators that can be used:- Comparison operator Description = Equal <> Not Equal != Not equal > Greater than >= Greater than or equal < Less than <= Less than or equal Table: Example: Equal operator In Oracle, equal (=) operator…