How To Create an SQL Query in Microsoft Access

SQL is a standard interactive and programming language for querying and modifying data and managing databases. Microsoft Access is a computer application used to create and manage computer-based databases on desktop computers and/or on connected computers (a network). To gather data from different tables in Microsoft Access we are using SQL Query. This article helps in understanding methods to create SQL query with different versions of Microsoft Access.

Creating SQL Query for MS Access. DDL(Data Definition Language) and DML(Data Manipulation Language) in SQL. There are four parts in select query. They are i) SELECT: to retrieve data from the a database; ii) FROM: table to retrieve data; iii) WHERE: restricts the rows selected to those for which the condition is true; iv) ORDER BY: the order in which the columns should be sorted.

Method to Create SQL Query in MS Access 2002 or 2003. Open you access database and select Queries in the Object column. Then double click Create Query In design View. Close the Show Table box that come up on top of the query window. On the Tool bar, a SQL button with a down arrow appears in bold. When you press this button, the SQL query comes up and you are able to write your SQL query. To use the query, save as then select the name to save it. To run the query, simply double click the query with the name you chose for it. When you have any query open, you can select the type of query using the button on the left of the toolbar as you did when you chose SQL query.

Method to Create SQL Query in MS Access 2007. Double-click your Access database file. Double-clicking the database file starts Microsoft Access and automatically loads the database. Click the “Queries” menu item in the main menu. This opens a list of queries available in the database. Double-click the icon labeled “Create new query in design view” to open a new window to create a new query.

Click the “Close” button at the initial window that shows a list of tables. Since you already have the SQL script, you don’t need to add any tables to the design view. Click the main icon in the Access menu that is labeled “SQL View.” This opens a large text box. Copy and paste your SQL script into this text box.

Click the “Save” button in the main Access menu. Close the query design view. This brings you back to the main query window. A new query is listed, which is the one you just created. Double-click its icon to display a results window.

Filed Under: Computers & Technology


About the Author: Justin Belden is a freelance web & graphic designer with over 15 years' experience. He is also an Avid member of the Design/Development community and a Serial Blogger who loves to help people by sharing interesting and informative tips and trick related to computer and technology.

RSSComments (0)

Trackback URL

Comments are closed.