Database: Access: Making an SQL query
Access is designed to make an QBE (Query By Example) query easy.
However, QBE queries are translated into SQL by Access, and you can
enter your own SQL queries to send to the database engine, just as
the Access interface does.
- Make a new query by clicking on Queries in the
Database Window. Double click on Create query in design view.
This opens a QBE window with a "Show Tables" dialog box in front.
Close the dialog box.
- Select SQL View from the leftmost toolbar icon or
by right clicking the Query window. You will now be presented
with a simple text editor window that starts with the
text "SELECT;". All queries start with the
SELECT
keyword, and end with a semicolon. Type your query here.
- Run the query by the clicking on the exclamation mark toolbar icon.
Access will then show you the result of your query as a table.
This is a beauty of relational databases that the result of a query is
a table. This means that you can use this "table" (called a view
when it is dynamically generated from a query) in many ways that a table
can be used.