Basic query statement for Oracle 10 Gb database-above

Source: Internet
Author: User

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

Related Article

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.