In fact, some basic functions of SQL commands have been mentioned in the previous article. However, through SQL commands, the programmer or database administrator (DBA) can: (1) create a database table. (Including setting the space available for the table) (2) changing the database system environment settings. (3) grant the user the ability and features to store SQL statements for a database or table
In fact, some basic functions of SQL commands have been mentioned in the previous article. However, through SQL commands, the program designer or database administrator (DBA) can:
(1) create a database table. (Including setting the space available for the table)
(2) change the database system environment settings.
(3) Grant users access to a database or table.
(4) Create index values for database tables.
(5) modify the database table structure. (Create, delete, or modify table fields)
(6) create data for the database.
(7) delete database data.
(8) modify data in the database.
(9) query data in the database.
These items can be done through SQL commands. does it look like there are more functions than the word "query?
SQL syntax classification
In fact, there are not a lot of SQL commands, but it is enough to use SQL in a few simple ways, because SQL commands are a syntax description for relational databases, therefore, SQL plays a very powerful role in this type of database. The following describes the basic SQL syntax commands commonly used in VB. Before you describe SQL commands and syntax, the following types of SQL statements are included in these types.
Predicates)
The method used in the SQL command to specify the record to be selected. Such as ALL, TOP, and DISTINCT.
Type 2: Declaration)
Declare the name and data type of SQL Parameter or Parameter Query, such as the Declaration of PARAMETERS.
Clause)
In SQL queries, some expressions are used to define query conditions to narrow the search scope, such as WHERE.
Class 4, operators and operands)
In SQL queries, expressions are formed together with Operation, for example, the BETWEEN... AND operator AND the INNER JOIN operator.
Category 5 Function)
Some common SQL functions, such as AVG (), are used to calculate the arithmetic mean.
Category 6, SQL statements (Statement)
SQL statements are the subject of SQL syntax. they are used to give instructions to a specific database and return relevant data. the syntax structure of SQL can basically be used below
Sub-statement: Command + condition clause
For example:
SELECT * from tab where tab. NAME = 'A'
"FROM... WHERE" is a condition clause. In fact, SQL syntax is not difficult. you only need to remember such a rule and believe that you can quickly understand 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 parts:
Predicate
As described above, it includes ALL, DISTINCT, DISTINCTROW, and TOP. we can use such statements to limit the results after the query.
*
Specify all fields from the specified table.
Table
Specifies the table name for the field of the selected record.
Field1, field2
The name of the field to read data. if more than one field is included, the data is read in the listed order.
Alias1, alias2
The alias used to replace the actual field name in the table.
Tableexpression
Table name or table that contains the data we want.
Externaldatabase
If it is not the current database, its name is defined in externaldatabase.
ALL, DISTINCT, DISTINCTROW, TOP attribute 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 selects all fields and queries the required dataset based on the specified conditions.
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.