Full access to SQL Syntax (3)

Source: Internet
Author: User
Tags contains dbase insert query table name
SQL syntax ORDER BY condition statement

This conditional clause, which is typically merged with a SELECT statement, is used to sort the results of a query according to a specified field.


SELECT FieldList


From table


WHERE Selectcriteria


ORDER BY field[asc| desc][,field2[asc| desc][,...]]


FieldList

The name of the field you want to query. which can be used with all,distinct,disinctrow, or top one.


Table


The name of the form you want to query.


Selectcriteria


The standard settings for the query.


Field1

Specifies that you want to follow that field as the basis for sorting, and if you do not add an order by query the dataset will not be sorted.

Asc

The ascending order category. (default value)


DESC

Descending order category.

For example:

Or we want to arrange the output data according to the order of birth, we can use the following command.


SELECT name, birthday

From staff form


ORDER BY Birthday

SELECT Lastname,firstname

From Employees

Order by LastName ASC;

In condition clause

Specifies which external database table to decisive victory. (Must be a database that the Microsoft Jet database engine can connect to, such as Dbase,paradox, and so on)

  
Select| Insert]into Destination in
{path| [' Path ' ' type ']| [' [Type;database=path]]}
From Tableexpression in
{path| [' Path ' ' type ']| [' [Type;database=path]]}
Destination


The name of the external table for which you want to insert data.

Tableexpression

The table name or the table name of the data being read. This parameter can be a single table name, or a section of SQL query that has been stored.

Path

Contains the full path name of the table.

Type

The type name of the database, which is usually used when the database department belongs to Jet databases. (For example: DBASE iii,dbase iv,paradox 3.x,paradox 4.x, or Btrieve)

For example: The following two paragraphs have the same meaning


Parta ..... From Table
In "" [DBASE iv;database=c:\dbase\data\sales;];

PARTB ..... From Table
In "C:\DBASE\DATA\SALES" "DBASE IV"



For example: Microsoft Jet Database


SELECT Customer number
From Customer table
In CUSTOMER. Mdb
WHERE customer number like "A *";
Where customer.mdbo is the database name for Jet database, which contains the Customer table.

For example: DBASE III or IV
SELECT Customer number
From Customer table
In "C:\DBASE\DATA\SALES" "DBASE IV"
WHERE customer number like "A *";
So when we use a database that is different from access, you must indicate the type name of the database.

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.