SQL syntax for example, the following two examples will have the same effect, and all fields will be returned from the employee table.
For example:
If we want to check out all the records in the employee table, we can do so through the following statement.
SELECT all* from staff form; DISTINCT
The field data that is selected for a table is slightly repetitive, that is, the record results for a field query are unique. For example, there are many staff on the staff form
The data may have the same name, so if we use the Select DISTINCT in the SQL statement, the query results will be filtered for different names. If you put
DISTINCT is omitted, such a query displays all of the records.
Distinctrow
Ignores records that are duplicates of the entire record, rather than just the data for one field.
Table
Specify the tables that are required for the query record.
For example:
SELECT Distinctrow Company Name
From customer form INNER JOIN order Form
On Customer table. Customer id= order form. Customer ID
Order by company name;
If you ignore Distinctrow, the following line of order data is generated for each company. In addition, if the distinctrow is used only in one form, it will be omitted.
Top
Returns data for a specific number of bars, starting with the first or last (using the ORDER BY condition clause).
For example:
When you want to know the name data of the top 25 students in the class in 2000, you can enter a statement like this:
SELECT Top 25 Student Name
form Student Form
WHERE Graduation Year =1994
Order by graduation score average score DESC;
If you do not add the order by this line of conditions, you will get the data, random data. In addition, after the top statement, in addition to adding numbers, you can also use the reserved
Word percent to query.
For example:
SELECT Top percent student name
From student form
Where graduation year =1994
Order by the average DESC graduation results;
Use of PARAMETERS (parameter) declarations
For parameter-type query syntax, the operation that declares the name of the parameter and the data type.
PARAMETERS name Datatype[,name datatype[,...]]
Name
The name of the parameters. You can use the parameter name as a string, and if the name contains an empty string, you can use the middle bracket to handle it, for example, "Vbeden".
DataType
Enter the data type of the parameter.
For example:
If you need to enter your name in a mobile query, you can do so by using the following methods:
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.