Oracle 9i provides a number of functions that can be used to assist in data queries. Next we introduce the commonly used function function and use method.
4.5.1 "Ceil" function
In the command edit area, enter select Mgr, Mgr/100,ceil (mgr/100) from Scott.emp, and then click the Execute button to see the results shown in Figure 4.29.
"See CD-ROM File": \ 4th Chapter \4.5\451.sql.
"Ceil" Function usage: ceil (n), to take the smallest integer greater than the banter 祅.
4.5.2 "Floor" function
In the command edit area, enter select Mgr, Mgr/100,floor (mgr/100) from Scott.emp, and then click the Execute button to see the results shown in Figure 4.30.
"See CD-ROM File": \ 4th Chapter \4.5\452.sql.
"Floor" Function usage: Floor (n), to take a maximum integer less than or equal to the value N.
4.5.3 "mod" function
In the command edit area, enter select Mgr, mod (mgr,1000), mod (mgr,100), mod (mgr,10) from Scott.emp, and then click the Execute button to see the results shown in Figure 4.31.
"See CD-ROM File": \ 4th Chapter \4.5\453.sql.
MoD function Usage: mod (m,n), take M to divide the remainder after N.
4.5.4 "Power" function
In the command edit area, enter select Mgr, Power (mgr,2), Power (mgr,3) from Scott.emp, and then click the Execute button to see the results shown in Figure 4.32.
"See CD-ROM File": \ 4th Chapter \4.5\454.sql.
"Power" function Usage: Power (m,n), take the n-th side of M.
4.5.5 "Round" function
In the command edit area, enter select Mgr, round (mgr/100,2), round (mgr/1000,2) from Scott.emp, and then click the Execute button to see the results shown in Figure 4.33.
"See CD-ROM File": \ 4th Chapter \4.5\455.sql.
"Round" function usage: round (m,n), rounded, keep n bit.
4.5.6 "Sign" function
In the command edit area, enter select Mgr, Mgr-7800,sign (mgr-7800) from Scott.emp, and then click the Execute button to see the results shown in Figure 4.34.
"See CD-ROM File": \ 4th Chapter \4.5\456.sql.
"Sign" Function usage: sign (n). N>0, take 1;n=0, take 0;n<0, take 1.
4.5.7 "AVG" function
In the command edit area, enter the Select AVG (MGR) average salary from Scott.emp, and then click the Execute button to see the results shown in Figure 4.35.
"See CD-ROM File": \ 4th Chapter \4.5\457.sql.
Avg Function Usage: AVG (field name), average. The required field is a numeric type.
4.5.8 "Count" function
(1) in the command edit area, enter the total number of select COUNT (*) records from Scott.emp, and then click the Execute button to see the results shown in Figure 4.36.
"See CD-ROM File": \ 4th Chapter \4.5\458-1.sql.
(2) in the command edit area, enter the total number of select count (distinct job) work categories from Scott.emp, and then click the Execute button to see the results shown in Figure 4.37.
"See CD-ROM File": \ 4th Chapter \4.5\458-2.sql.
Count function Usage: count (field name) or count (*), total count.
4.5.9 "min" function
In the command edit area, enter the minimum salary for select min (sal) from Scott.emp, and then click the Execute button to see the results shown in Figure 4.38.
"See CD-ROM File": \ 4th Chapter \4.5\459.sql.
Min function Usage: min (field name) to calculate the decimal value of the field.
4.5.10 "Max" function
In the command edit area, enter select Max (SAL) top salary from Scott.emp, and then click the Execute button to see the results shown in Figure 4.39.
"See CD-ROM File": \ 4th Chapter \4.5\4510.sql.
Max function Usage: max (field name), calculates the maximum number of numeric fields.
4.5.11 "Sum" function
In the command edit area, enter the "select SUM (SAL) salary sum from scott.emp;", and then click the Execute button to see the results shown in Figure 4.40.
"See CD-ROM File": \ 4th Chapter \4.5\4511.sql.
Sum function Usage: sum (field name) to calculate the sum of numeric fields.
Through the above 4 kind of inquiry instance's study, the reader may extrapolate, the nimble application. SQL data query is introduced here, the following learning how to input data.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.