An SQL query is a command used to retrieve, insert, update, or delete data in a database. For example, imagine you have a table called “Customers” containing fields such as Last Name, First Name, and City. If you want to display all customers residing in Lyon, here is the SQL query to use: SELECT Last Name, First Name FROM Customers WHERE City = “Lyon”.
To explain this query, SELECT Last Name, First Name specifies the fields to display, FROM Customers indicates the relevant table, and WHERE City = “Lyon” establishes the selection criteria.
In Access, to execute a query, open the Access database and select “Query” from the ribbon. Then, choose “Query Design” in the left pane. In the “View Tables” window, choose the table you want to work with and double-click the fields you want to display. Additional selection criteria can be added using the “Criteria” row. Finally, to view the results of the query, simply click on “Run”.