SQL syntax SQL features and features
In fact, in the previous article, some basic functions of SQL commands have been mentioned, however, through SQL commands, a program designer or database administrator (DBA) can:
(i) Tables for the establishment of the database. (including the space you can use to set up the table)
(ii) Change the database system environment settings.
(iii) grant user access to a database or table.
(iv) Establish index values for database tables.
(v) Modify the database table structure. (New, delete, or modify a table field)
(vi) New data for the database.
(vii) The deletion of data from the database.
(eight) data modification of the database.
(ix) Queries for data on the database.
These are things that can be done through the SQL command, does it seem to be more than the "query" two characters represented by more than the function?
Classification of SQL syntax
In fact, the SQL command is not very much, but to use the acme of SQL, but only a few short commands will suffice, because the SQL command is a relational database of the syntax of the narrative, so SQL in such databases play a very strong function, The following is an introduction to the basic commands for SQL syntax commonly used in VB. Before describing SQL commands and using syntax, the following classification of SQL has been included in the type used in SQL syntax, which can be said to be contained in these categories.
First class, Attribute word (predicates)
The way in the SQL command to indicate the record you want to select. such as all, top and distinct and so on.
Category II, declarations (declaration)
Make a statement about the name and data type of SQL parameter or parameter Query, such as the parameters declaration, and so on.
Third class, conditional clause (Clause)
In SQL queries, some expressions are used to define the criteria for a query to narrow the search, such as where.
Class fourth, operators (Operator) and operands (Operation)
In SQL queries, together with Operation Expressions (Expression), such as between .... The AND operator is the number of inner join operations.
Class fifth, functions (function)
Some common SQL functions, such as AVG (), are functions that calculate the average of arithmetic.
class sixth, SQL statements (Statement)
SQL statements, which can be said to be the body of the SQL syntax, to give instructions to a particular database, and return the relevant data, and SQL syntax structure, can basically use the following
: COMMAND + conditional clause
For example:
Select*from TAB WHERE tab.name= ' A '
of which "from .... WHERE "is a conditional clause, in fact, the syntax of SQL is not difficult, you just remember such a rule, I believe you can quickly understand the SQL usage.
SQL syntax and commands
SELECT statement
select[predicate]{*|table.*|[ Table.] field [, [table.] field2[,...]]} [As ALIAS1 [, alias2[,...]]]
From Tableexpression [,...] [In Externaldatabase]
[WHERE ...]
[GROUP by ...]
[Having ...]
[Order BY ...]
[With Owneraccess OPTION]
The SELECT statement includes the following sections
predicate
As mentioned earlier, including All,distinct,distinctrow, and top We can use such statements to limit the results of the query.
*
Specifies all of the fields from the specified table.
Table
The name of the table specified for the field of the selected record.
Field1,field2
The name of the field that you want to read the data, and if more than one field is included, the data is read in the order listed.
Alias1,alias2
Used to override the alias of the actual field name in the table.
Tableexpression
Table name or table that contains the data we want.
Externaldatabase
If you use a database that is not current, define its name in Externaldatabase.
All,distinct,distinctrow,top Property Word Usage
SELECT [all| Distinct| distinctrow| [Top n[percent]]] From table
All
If you do not specify any field data, the Microsoft Jet database engine (DB engine) selects all the fields and queries out the requirements data set based on the criteria that are set.
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.