How do you write a SQL query to select specific columns and rows from a table?

To select specific columns and rows from a table in SQL, you can use the following syntax:

sql
SELECT column1, column2, ... FROM table_name WHERE condition;

Here, column1, column2, etc. are the names of the columns you want to select. You can specify multiple columns separated by a comma. The WHERE clause is used to filter the data and return only the rows that meet the specified conditions.

For example, to select the first_name and last_name columns from the employees table where the age is greater than 30:

sql
SELECT first_name, last_name FROM employees WHERE age > 30;