Here's an example code on how to use SELECT in SQL:
Let's say we have a table named "employees" with the following columns: "employee_id", "first_name", "last_name", "email", "hire_date", and "salary". We want to retrieve the first and last names of all employees who have a salary greater than $50,000.
Here's the SQL code using the SELECT statement:
SELECT first_name, last_name
FROM employees
WHERE salary > 50000;
Explanation of the code:
SELECT
is used to specify the columns to retrieve from the table. In this case, we want to retrieve the first_name and last_name columns.FROM
is used to specify the table to retrieve the data from. In this case, we want to retrieve the data from the employees table.WHERE
is used to filter the results based on a specified condition. In this case, we want to retrieve only the employees who have a salary greater than $50,000.
The code will return a list of all employees who have a salary greater than $50,000, with their first and last names displayed in separate columns.
I hope this example helps you understand how to use SELECT statement in SQL.