:
SELECT * FROM(SELECT z.type , z.code ,ROW_NUMBER()OVER(PARTITION BY z.type ORDER BY z.code) AS code_idFROM group_info z)WHERE code_id =1;
The over () mentioned here is an oracle analysis function.
Refer to the SQL reference document:
Analytic functions compute an aggregate value based on a group of rows. They differ
functions.1. Detailed process Example 1.1
We consider the following given SQL:
select sysdate from dual;
Run and query v $ SQL in Oracle 10 Gb. The SQL _ID of this SQL statement is
SQL
oracle| function (author: Star Prodigal zhongcfido@126.com)
Ocidefinebyname
Allow the SELECT command to use PHP variables.
Syntax: boolean ocidefinebyname (int stmt, string ColumnName, mixed variable, int [type]);
Return Value: Boolean value
Types of functions: Database features
Content Description
This function is used to define the specified PHP variable so that it can be used by the SELECT com
Label:
Turn from: http://www.2cto.com/database/201209/154045.html Oracle
the REGEXP_SUBSTR function Instructions for using the REGEXP_SUBSTR function in Oracle: The topic is as follows: In Oracle, a statement is implemented to split ' 17,20,23 ' into a collection of ' 17 ', ' 20 ', ' 23 '. The REGEXP_SUBSTR func
Oracle cold, stay at home and read the "Mastering Oracle SQL" 2nd, found that Oracle's function is still very strong, there are 200 optical functions, hsql is difficult to match. The next stubborn, it seems either to risk using Hibernate3.0 SQL mapping function, or to run th
(Sal),Min(Sal),Avg(Sal),Sum(Comm)From EMPGroupby DeptnoHavingAvg(Sal) > 2000;The having equivalent to the nested where, that is, the above statement is equivalent to the following one.SELECT *From(Select Deptno,count (*max ( Salmin (Sal Avg (Salsum (comm from emp group by deptno ) where asal >; 6.4.7 Analytic Function https://docs.oracle.com/cd/E11882_01/server.112/e41084/functions004.htm#SQLRF06174Aggregate
Oracle has two functions: lead and lag, which are the analytic functions used to compute offsets, and the two functions are the same in use.
The Oracle official documentation explains:
The lead is a
Label:Oracle's rounding and rounding functions--floor,round,ceil,trunc usage instructions(2011-04-06 16:10:35) reproduced
Tags: talk
Category: Fade Away
floor--the integer digits of a given numberSql> Select Floor (2345.67) from dual;Floor (2345.67)--------------2345 ceil--Returns the smallest integer greater than or equal to the given numberSql> Select Ceil (3.1415927) from dual;Ceil (3.1415927)---------------4 ro
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:
www.2cto.com SQL> col dump_string for a50SQL> set lin 200SQL> select global_name, dump (global_name, 1017,8, 5) dump_string from global_name; GLOBAL_NAME DUMP_STRING ------------------------------ ------------------------------------------------ ORACLE. WORLD Typ = 1 Len = 12 CharacterSet = ZHS16GBK: W, O, R, L, D 54. EMPTY_BLOB () and EMPTY_CLOB () are both functions
Tags: style class blog Code java HTTPabout several Oracle functions that handle the number of decimal places ()1. Take a few decimals roundedSelect round(1.2345,3) fromdual; Results:1.2352. Keep two decimal places, onlySelectTrunc1.2345,2) fromdual; Results:1.23SelectTrunc1.2399,2) fromdual; Results:1.233take an integer to return the largest integer greater than or equal to x:
Overview of major Oracle data types: The data types supported by various databases are similar, which may differ slightly from those in standard SQL languages. Type: varchar2: You can set the maximum length of a field when declaring it. After using it, you do not have to consider the existence of spaces. If the length of the inserted string is lower than the upper limit, the system automatically
Overview of
Oracle Aggregate functions has been used a lot. The official website is described as follows:
Aggregate functions
Http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions003.htm#SQLRF20035
Aggregatefunctions return a single result row based on groups of rows, rather than onsingle rows. aggregate functions can
Label:This article describes Oracle Analytic function usage, first building the library:SQL code
CREATE TABLE earnings --working Money table
(
Earnmonth VARCHAR2 (6), --Working month
Area VARCHAR2 (a), --working areas
Sno Varchar2 (Ten), --migrant worker number
Sname Varchar2 (a), --the name of the working person
times int, --Number of jobs this month
Singleincome number (10,2),
Feel that some netizens always put forward some very basic questions, for example, there is no function to achieve such functions ah, what is the function of Ah, what the format is, and so on, but also feel their understanding of the lack of Oracle function, so focused on the remainder of the time to focus on the Oracle function, small heart is afraid to be conce
: MI: SS 'yyyy', 'mm', 'dd', 'hh12', 'hh24', 'mi', and 'ss;
■ Changing the date format in DB2: Current timestamp 'current date', 'current time', and so on;
NOTE 2:
■ Changing the Data Type of SQL Server to "data type parameters": int and varchar;
■ Oracle Data Type Change functions: to_char (), to_date (), to_number (), and so on;
■ DB2 data type change
Oracle note (5) single-row functions although each database supports SQL statements, each database also has the operation functions supported by each database. These are single-row functions, if you want to develop a database, you need to learn more
support table alias with AS.So you can write the following statement.Select * from table as alias;If you add a derived fieldto query, Oracle requires an alias. Otherwise you will get an error. as follows:Select rownum,* from HR. countries;RePort error:ora:00936, missing expression.Change to use as follows:Select rownum,c.* from HR. Countries C;hash functions in 4.oracl
d.dept_no = e.dept_no (efficient): Select Dept_no,dept_name FRO M DEPT D where EXISTS (SELECT ' X ' from EMP E WHERE e.dept_no = d.dept_no);SQL statements are capitalized, because Oracle always parses the SQL statements first, converting lowercase letters to uppercase.(20) Use the connector "+" connection string sparingly in Java code.(21) Avoid using not on ind
that can be used in addition to group by? The Niang the result also really has, over (partition by) function, then it and peacetime uses group by have what difference? Group BY In addition to the results of a simple grouping, and commonly used with aggregate functions, Partition by also has a grouping function, belongs to the Oracle analysis function, here is not detailed no no, no.
Look at the code:
O
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.