Oracle 10gBasic Database Query statements-above--Reference: Zhang lie Zhang Jianzhong Database Administrator training handout
Principles for writing SQL statements
The case is not sensitive, but the case sensitivity of single and double quotes. Remember!
Keyword cannot be abbreviated
It can be written by branch, but keywords cannot be written across lines.
Generally, each clause is a row.
Supports typographical layout to increase readability.
String with single reference
Double quotation for column aliases
Select Statement
Query the specified row
Queries the specified Column
Joint query of multiple tables
SelectStatement can be used to query specified rows, specified columns, or multiple tables to obtain data. In the above three sentences, I have definedSQLBasic functions, efficient writingSQLStatements are our eternal pursuit, whether you are a programmer or a database administrator.SelectIt is both essential for getting started and the peak of the database.
Related reading:
Basic query statement for Oracle 10 Gb database-above
Basic query statement for Oracle 10 Gb database-Medium-Function
Basic query statement for Oracle 10 Gb database-bottom-connection & subquery
Simple syntax SELECT * | {[DISTINCT] column | expression [alias],...} FROM table;
Uppercase keywords
The name we specify in lower case
SELECTClause specifies the column you are concerned about
FROMClause specifies the table you want to query
It is called simple syntax because it is completelySELECTThe syntax is very long and involves many logical relationships. Although
You can't grow up, but you can always do it.
GenerallySelectCalledSelectClause,FromCalledFromClause.
Experiment 1: Write the simplest SQL statement to query all rows and columns in a table
This experiment aims to give a preliminary understandingSQLStatement,Execute the simplest Query.
UseScottInPL/SQL. 2.16.7Log on to the tool
650) this. width = 650; "border = 0>
View All Tables of the current user .
650) this. width = 650; "border = 0>
ViewEmpAll table information.
650) this. width = 650; "border = 0>
QueryEmpAll rows and columns in the table. For small tables, we can write in this way. For large tables, we generally query rows with specified conditions and selected columns.EmpTable inScottUser. ScottThe user is an exercise account,The password isTiger,If you do not have this account, you can create it at any time.,After the exercise is completed, you can delete it at any time..Trick,Lingering.
Lock and unlockScottAccount:
650) this. width = 650; "border = 0>
Switch account
650) this. width = 650; "border = 0>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Next Page
|