If you are performing Oracle SELECT operations in Oracle query statements, you may not be able to understand Oracle SELECT operations in Oracle query statements, you can use the following articles to learn about its practical application and functions. The following is a detailed introduction of the article.
SELECT field name 1, field name 2 ,...... FROM table name 1, [Table name 2,...] WHERE condition;
Field names can be imported into functions.
For example, COUNT (*), MIN (field name), MAX (field name), AVG (field name), DISTINCT (field name ),
- TO_CHAR (DATE Field name, 'yyyy-MM-DD HH24: MI: ss ')
NVL (EXPR1, EXPR2) Function
Explanation:
- IF EXPR1=NULL
- RETURN EXPR2
- ELSE
- RETURN EXPR1
DECODE (AA, V1, R1, V2, R2....) Function
Explanation:
- IF AA=V1 THEN RETURN R1
- IF AA=V2 THEN RETURN R2
- ELSE
- RETURN NULL
LPAD (char1, n, char2) Functions
Explanation:
Character char1 is displayed based on the specified number of digits n. The reserved number of digits is replaced by the reserved number on the left using the char2 string.
Arithmetic Operations can be performed between Field Names
Example: (field name 1 * field name 1)/3
The query statement can be nested.
Example: SELECT ...... FROM
(Oracle SELECT ...... FROM table name 1, [Table name 2,...] WHERE condition) WHERE condition 2;
The results of two query statements can be set.
Example: UNION (remove duplicate records), union all (do not remove duplicate records), difference set MINUS, intersection INTERSECT
Group Query
SELECT field name 1, field name 2 ,...... FROM table name 1, [Table name 2,...] Group by field name 1
[HAVING condition];
Query connections between two or more tables
SELECT field name 1, field name 2 ,...... FROM table name 1, [Table name 2,...] WHERE
Table Name 1. Field name = table name 2. Field name [AND…] ;
Oracle SELECT field name 1, field name 2 ,...... FROM table name 1, [Table name 2,...] WHERE
Table Name 1. Field name = table name 2. Field name (+) [AND…] ;
The position of a field with a (+) number is automatically null.
Sort the query result set. The default sorting is ASC in ascending order and DESC in descending order.
Oracle SELECT field name 1, field name 2 ,...... FROM table name 1, [Table name 2,...]
Order by field name 1, field name 2 DESC;
Fuzzy string comparison
INSTR (field name, 'string')> 0
Field name LIKE 'string % '[' % string % ']
Each table has an implicit field ROWID, which indicates the uniqueness of the record.