) asNumcomimgwhereRowNumber> + Results: These two methods, is just a list of rewnumber? Of course not, look at the internal differences: On two SQL, add the following SQL, and use MS's "include execution plan" to see execution Details: SET STATISTICS on
GO SQL to execute: SET STATISTICSTime on
GO
Select Top TenNumcomimg.* from
( SelectRow_number () Over(Order byIdASC) asRowNumber* from(Select * from [Tccline].[dbo].[Cline_commonimage]) ascomimg) asNumcomimgwhereRowNumber> +
SET STATI
In the company often use the Oracle analysis function, in statistics this piece of useful, especially complex SQL query, I am here to combine the network some information to summarize, hope can help everyone:Oracle Analytic functions--List of functionsSUM: The function calculates the accumulation of expressions in a group andMin: Find the minimum value of an expr
3P088888888888 2016-02-11 3 4P088888888888 2016-02-14 3 5P088888888888 2016-02-12 1 6P088888888888 2016-02-10 1 7RANK and Dense_rank-rank () The rank of the data item in the grouping, the rank equal will leave the vacancy in the position-dense_rank () The rank of the data item in the grouping, the rank equal will not leave the vacancy in the rankSELECT Polno,Createtime,Pnum,RANK () over (PARTITION by Polno ORDER by pnum Desc) as RN1,Dense_rank () over (PARTITION by Polno ORDER by pnum Desc) as
call. hf_dm_visit_record rGroup by r. sample_id)
If we change to write the analysis function, oracle only needs to scan the hf-dm_visit_record table once, but there is a SORT cost of WINDOW SORTSQL> SELECT a. sample_id,A. result_code,2 3 a. reason_code,A. begin_timeFROM (SELECT r. sample_id,R. result_code,R. reason_code,R. begin_time,ROW_NUMBER ()OVER (partition by r. sample_id order by r. sample_id)CntFROM call. hf_dm_visit_record r)WHERE cnt = 1; 4
Directory===============================================1. The arrangement with null value2.top/bottom N Query3.first/last ranking Query4. Query by LevelOne, with a null value of the arrangement:In the previous article on Oracle development topics: Analytic functions 2 (Rank, Dense_rank, row_number), we have learned how to arrange and group records in a full arra
Analysis function over and open window function
One: Analysis function over
Oracle provides analytic functions from 8.1.6, which are used to compute some sort of aggregation value based on a group, and the difference between it and the aggregate function is
Multiple rows are returned for each group, and aggregate functions
Tags: aggregation statistics HTTPS GROUP by has a WWW false log packet1, Row_number () over () sorting function:(1) Row_number () over () Grouping sorting function:When using the Row_number () over () function, the grouping in over () and the execution of the sort are later than the where group by order by.Partition by is used to group the result set, and if it is not specified then it takes the entire result set as a grouping, which differs from the aggregation function in that it can return mu
Single-record functions in SQL1. ASCIIReturns the decimal number corresponding to the specified character;SQL> select ascii ('A') A, ascii ('A') A, ascii ('0') zero, ascii ('') space from dual;A ZERO SPACE------------------------------------65 97 48 322. CHRReturns the corresponding characters;SQL> select chr (54740) zhao, chr (65) chr65 from dual;ZH C---Zhao3. CONCATConnect two strings;SQL> select concat ('010-', '000000') |' to 23' Gao Qian competin
Keywords: Oracle numeric function-type date conversion To_char automatic type conversion Date type numeric converter other function numeric functionABS: Find the absolute value function, such as: ABS (−5) 5SQRT: square root function, such as: sqrt (2) 1.41421356Power: exponentiation function, such as: 2,3 8COS: cosine trigonometric functions, such as: cos (3.14159) −1MoD: Find division remainder, such as mo
information technology Select Replace (deptno, ' 01 ', ' information technology ') from users;
Use the Age field in the Employee Information table with 10 to select mod (age,10) from users;
Year of entry of employee: Select Extract (from RegDate) from users;
Find employee information for May entry select * from Users where extract (month from regdate) = 5; Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. Numerical
Oracle date functions:
Months_between: returns the difference of the month between two dates months_between ('01-EP-95 ', '11-Jan-94') ==> 19.6774194 add_months: Number of copies added to the date. add_months ('11-Jan-94 ', 6) ==> '11-JUL-94' next_day: Specifies the day after the date. next_day ('01-SEP-95 ', 'Friday') ==> '08-SEP-95' last_day: the last day of the month. last_day ('01-SEP-95) ==> '30-SEP-9
Single record function in SQL 1. ASCII returns the decimal number corresponding to the specified character; SQLselectascii (A) A, ascii (a) a, ascii (0) zero, ascii () spacefromdual; The AAZEROSPACE------------------------------------659748322.CHR gives the integer, returns the corresponding character; SQLselect
Single record function in SQL 1. ASCII returns the decimal number corresponding to the specified character. SQL select ascii (A) A, ascii (a) a, ascii (0) zero, ascii () space from dual;
Common Oracle functions-character and mathematical functions, oracle mathematical functions
Various functions are often used in the development and use of oracle. This chapter summarize
Common Oracle functions-date functions, oracle date functions
In the development and use of oracle, a variety of date functions are often used. The online date
to 0)1 Sample:2 Select round(123.456,0) fromDual Return123
3 Select round(123.456,1) fromDual Return123.5
4 Select round(-123.456,2) fromDual Return-123.46 3.ceil and Floor functionsThe ceil and floor functions are sometimes useful when it comes to business data. Ceil (n) takes the smallest integer greater than or equal to the value N, and Floor (N) takes the largest integer less than or equal to the value N; turn from: http://www.2cto.com/database/2
--------------------------------------------------------------------------------Oracle. World typ = 1 Len = 12 characterset = zhs16gbk: W, O, R, L, d
54. empty_blob () and empty_clob ()Both functions are used to initialize fields of the big data type.
55. GreatestReturns the maximum value in a group of expressions, that is, compare the encoding size of characters.SQL> select greatest ('A', 'AB', 'ac') from
Single-record functions in SQL 1. ASCIIReturns the decimal number corresponding to the specified character;SQL> select ascii ('A') A, ascii ('A') A, ascii ('0') zero, ascii ('') space from dual;A ZERO SPACE------------------------------------65 97 48 322. CHRReturns the corresponding characters;SQL> select chr (54740) zhao, chr (65) chr65 from dual;ZH C---Zhao3. CONCATConnect two strings;SQL> select concat ('010-', '000000') |' to 23' Gao Qian competi
This article is not ready to introduce all of the Oracle functions, in the current situation, I do not have this time, need to learn too much, to spend most of the time on learning to use the technical aspects:), so if you are ready to learn all the Oracle functions of friends, or to focus on:
the right of the decimal point. The default value of N2 is 0, if N2 is a negative number, it is rounded to the corresponding digit on the left of the decimal point (although the N2 value mentioned in Oracle documents must be an integer, in fact, the judgment here is not rigorous, even if N2 is not an integer, it will also automatically perform processing after the N2 is rounded up. However, we need to pay special attention to other points that must b
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.