SQL View in Microsoft Access 2013

The queries that we created and modfied were all done in Design view. This is a user-friendly interface that allows you to create queries easily by visualizing the tables used in the query and having options made available to you.

But whenever you use Design view to construct a query, behind the scenes, MS Access is constructing an SQL statement in order to make the query work. For every query you create, there's an SQL statement hiding in the background.

Well it's not quite "hiding"... after all, you can view it any time you wish. To do this, you need to go into SQL View.

Switch to SQL View

To switch to SQL view, you simply click the SQL icon at the bottom-right corner of Access:

Screenshot of SQL view icon

You can also choose SQL View from the View icon at the top-left of the Ribbon.

SQL Statment

Once in SQL view, you will see a SQL statement. This SQL statement represents the query that you constructed. Here's the SQL view of the last query that we performed:

Screenshot of our last query in SQL view

If you're not familiar with SQL, this might look a little scary. But it needn't be that way. That SQL statement is simply extracting records from the database using our precise criteria.

Let's look at a less complex SQL statement:

The above SQL statement returns the FirstName and LastName fields from the Customers table. It returns all records, because we didn't specify otherwise.

If we wanted to specify only some records, we would need to add some criteria to the statement. Here's a modified statement:

Like the first example, the above SQL statement returns the FirstName and LastName fields from the Customers table. But in this example, we are only returning records where the customer's last name is "Griffin".

As you can see, each time we add criteria to our query in Design view, that criteria is added to the SQL statement, and we can limit the results by only those exact records that we are interested in.

These are simple examples to demonstrate how SQL works. Feel free to tweak queries in Design view and switch over to SQL view to see how it changes the SQL statement. If you're interested in learning more about SQL, check out my SQL tutorial.

Next we're going to create a macro.

There's also a tutorial for Access 2016.