Learn SQL language notes

xiaoxiao2021-03-06  68

(1)

Data in the database is case sensitive in cases, many companies use capital letters in this feeling when stocking data.

All the field names will also be uppercase letters, will not be available when the retrieval condition is Name = 'lincoln'.

To any result, this situation will encounter in each instance application.

Note that case in SQL statements is insensitive (2)

For the digital type, the right alignment is used to use the left alignment for the character type ---- refers to the SELECT output in SQLPLUS (3)

SELECT AND SELECT All is the equivalent Select All no matter whether you repeat SELECT DISTINCT to remove repetition (4) expression - conditional statement ---- clause

(5) You can press (Syntax Column Name Alias) to rename any column to have spaces between column names and aliases.

Wholesale 0.25

Retail (6) If you want to find all the states you can use to use the following statement

SELECT * from Friends Where State Like 'C_'

The example below will find all

Record of the second letter

input Output

SQL> SELECT * from Friends Where firstname like '_l%' (7) Count sum avgm MAX MIN

Variance variance STDDEV standard deviation

AddMonths

Last_day

Months_between See Months_between is a sensitive month value for the order of the month you give.

The number may not be a bad thing, for example, you can use a negative value to determine if a certain date is in another date.

(8) ABS CEIL FLOOR

EXP

MOD

SIGN (return 1, -1 or 0 to see the parameter value is negative) or a positive number)

Power (a, b) seeking a B power

SQRT (a) seeking a square root of A

(9) CHR This function returns the character returned by the value of the value or the like, depending on the character set dependent on the database.

Concat connection string

INITCAP This function changes the first letter of the parameters to uppercase that other letters are converted into lowercase

LOWER and UPPER

If you expect that LOWER converts the parameters to all lowercase letters, UPPER converts all the parameters into big letters.

mother

Substr (A, X, Y) acquire a string of Y length from the X position starting from the X position. If the second parameter is a negative number, it will start a positional example of positioning the absolute value of the negative number from the tail of the source string.

Such as

(10) TO_CHAR TO_NUMBER

(11) Order By clause

The DESC behind the ORDER BY represents replacing the default ascending ASC in descending order.

A column of 正 顺 排

Column, the second column is arranged in an inverse order of letters

SELECT * from Checks

Order by payee ASC,

Remarks desc (12) group by

COL

Packet by colol (13)

Summary function cannot work in where clause If you want to make this query

If we need some new things - Having clauses, the Having clause allows you to summarize the function as the condition.

转载请注明原文地址:https://www.9cbs.com/read-110511.html

New Post(0)