ORACLE-filtering and sorting-oracle foundation

1. Filtering

1. Characters and dates should be enclosed in single quotation marks;

2. The keywords of sql are not case-sensitive, but the values ​​in the conditions are case-sensitive;

3. When the date type is converted into a string, the date type also needs to add single quotation marks;

4. Conditional qualifiers are:

= equal
> more than the
>= greater or equal to
< less than
<= less than or equal to
<>/!= not equal to
:= assign
between...and... between two values ​​(including boundaries)
in  
like fuzzy query

 

 

 

 

 

 

 

 

Fuzzy query: %a%: character contains a

%a The last character in the string is a

The first character in a% string is a

The second character in the _a string is a

The third character in the __a string is a

_ means a character

If the query string already contains an underscore (_), the escape character "\" should be used, written as %\_%, or "#" .

is null is empty

is not null

and logical and

or logical or

2. Sorting

order by column asc  正序

order by column desc reverse order

You can also sort by a column first, and then sort by another column, such as: order by column1 asc,column2 desc ;

Attachment: Suggested writing of time clause

In the where clause of the time type: when time is used as a conditional query, it is recommended to write:

where to_char(column_date,'yyyy-mm-dd') between '1998-02-01' and '1998-05-01'

It is not recommended to write:

where column_date between '1-Feb-1998' and '1-May-1998'   is not recommended

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324980014&siteId=291194637