QP School
SELECT statement with MS Access SQL - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: MS Access SQL Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=52)
+--- Thread: SELECT statement with MS Access SQL (/showthread.php?tid=5284)



SELECT statement with MS Access SQL - Qomplainerz - 07-27-2023

Example:

SELECT employee_id, first_name, job_title
FROM employees
WHERE job_title = 'Manager';

Let's break down the SQL code:

SELECT: This keyword indicates that we want to retrieve data from the table.
employee_id, first_name, job_title: These are the columns we want to retrieve data from. 
We specified three columns: "employee_id," "first_name," and "job_title."
FROM: This keyword indicates the table from which we want to retrieve data. 
In this case, we want data from the "employees" table.
WHERE: This optional keyword is used for filtering the rows. 
We can specify a condition to retrieve only those rows that satisfy the given condition.
job_title = 'Manager': This is the condition specified in the WHERE clause. 
It means we only want to retrieve rows where the "job_title" column has the value "Manager."

When you run this SQL code as a query in Microsoft Access, it will return a result set containing the "employee_id," "first_name," and "job_title" columns for all employees who have the job title "Manager." The result will be displayed in the Datasheet View, showing only the relevant information based on the specified condition.