Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use functions in SQL

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "how to use functions in SQL", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use functions in SQL" this article.

1. Dual table

Pseudo table

A column of dummy and a row of values of X

2. Character function

Case conversion

Character processing

Common summary

3. Numeric function

Round is rounded

Select round (45.923), round (45.923), round (45.923) from dual

Trunc rounding, truncation

Select trunc (45.923), trunc (45.923), trunc (45.923) from dual

Mod remainder

Select trunc (1600gam300), mod (1600300) from dual; to find quotient and remainder

4. Date function

Sysdate returns the current date and time of the operating system where the Oracle database server resides

Months_between calculates the month between two dates

Add_months

Next_day

Select next_day (sysdate,'MONDAY') from dual; next Monday (current time)

Last_day

Select sysdate,last_day (sysdate) from dual; last day of this month

Date round

Date trunc

5. Conversion function

Implicit conversion: data type matches default format

Show conversion to_char to_number to_date

6. General function

NVL function

Convert a null value to a numeric value

Data types must match

Nvl (comm,0)

NVL2 function

NVL2 (expr1,expr2,expr3) returns the value of parameter 2 if parameter 1 is not empty not null, otherwise it returns the value of parameter 3.

Nvl2 (comm,sal+comm,sal)

Nullif function

Nullif (expr1,expr2) compares whether the two expressions are the same, and returns null if the same, and expr1 if different.

7. Conditional expression

Decode and case

8. Grouping function

The above is all the content of this article "how to use functions in SQL". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report