My Oracle Career (2) basic content

Source: Internet
Author: User

Organize some sql&plsql statements

as Alias

Select X as Y from ...//use Y to display the X column name

DISTINCT to remove duplicate rows

Select DISTINCT x from ...//table to filter x rows of data that are not duplicated

in range filtering

Select X from Y where z in (A, B)//select Z==a | | X column data for z = = b

like fuzzy query

Select X from Y where z like '%_a_% '//z matches any number of arbitrary characters + single character +a+ single character + any number of characters

Order by sort

Select X from y order by Z//Sort by Z ascending order by z desc Descending

Group by group

Select SUM (x) from Z where....group by a, b//After grouping by A/b x and (for example, ask for a class all girls age and so on)

having Judgment after GROUP by

TRANSLATE keyword substitution

TRANSLATE (A,A1,A2)//A is the content, A1 is the keyword, A2 is the replacement content and the A1 in A is replaced by A2

SUBSTR truncation Field

SUBSTR (A,A1,A2)//A to intercept A2 length from A1

INSTR Find

INSTR (A1,A2,B1,B2)///A1 looking for A2,B1 is from the beginning of the search (negative numbers to the left, positive to the right), B2 is the first occurrence, return position

SEQUENCE sequence//To table data automatic arranging, serial number is not duplicated

CREATE SEQUENCE A (table name)

MINVALUE 1//min 1

MAXVALUE 100//MAX 100

Start with 1//sort starting from 1

INCREMENT by 1//increments by 1 each time

NOCACHE//No cache

Nocycle//Non-cyclic

index; a column created to increase the efficiency of database queries

CREATE INDEX X on table_name (col_1,col_2,...)

synonym synonyms//In order to facilitate the different tables, different columns and so on in the same file of the uniform address and pay a name

CREATE synonym xxx for YYY//At this time xxx and YYY are xxx

DROP synonym XXX//revoke synonym XXX

My Oracle Career (2) basic content

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.