Ms Access 简明教程

MS Access - SQL View

在本教程中,我们将介绍 SQL 视图。无论何时在查询设计器中创建一个查询,Access 都会自动为你创建 SQL 查询。这实际上是从表中检索数据。如需了解在查询设计器中创建查询时你的查询如何以 sql 创建,让我们打开你的数据库。

In this chapter, we will be covering the SQL view. Whenever you create a query in query design, Access automatically creates the SQL query for you. This actually retrieves data from the tables. To see how your query is created in sql when you create it in query design, let us open your database.

Create 选项卡中选择 Query Design ,并添加 tblEmployees 表。

Select the Query Design from the Create tab and add the tblEmployees table.

sql view
employee design

选择要作为查询结果的字段,然后运行查询。

Select the field you want to see as query result and then run your query.

field query result

现在可以将所有员工信息作为查询结果查看。已在查询网格中选择特定字段;与此同时,MS Access 还使用从查询网格中获得的结果创建了 SQL 查询。

You can now see all the employee information as query result. You have selected certain fields in the Query Grid; at the same time, MS Access has also created an SQL Query with the results obtained from your Query Grid.

若要查看 SQL,请转至“开始”选项卡。从“视图”菜单中选择 SQL View ,你将看到该查询的 SQL。

To view the SQL, go to the Home tab. Select SQL View from the View menu and you will see the SQL of your query.

home tab

Example

以下是另一个示例,其中我们将看到正在进行的项目。

The following is another example wherein, we will see the projects in progress.

project progress
navigation relationship

现在让我们运行查询。

Let us now run your query.

task title

若要查看 SQL,请从“视图”菜单中选择“SQL 视图”。

To see the SQL, select the SQL View from the View menu.

sql query

可以看到 Access 自动生成的 SQL 查询。这有助于从两个表中检索数据。

You can see the SQL query which is generated by Access automatically. This helps retrieve data from two tables.