The SELECT statement is used to fetch data from one or more tables in a database.
SQL SELECT Syntax
SELECT column1, column2, ... FROM table_name;
column1, column2, ...are the columns you want to retrieve.table_nameis the name of the table from which to retrieve the data.
To select all columns from a table, you can use the asterisk (*) wildcard:
SELECT * FROM table_name;
SQL SELECT Examples
We’ll use the Patients table to demonstrate the functionality of the SELECT function.

SQL SELECT All Columns Example
To retrieve all information about patients, apply the SELECT * function directly to the table.

SQL SELECT Specific Columns Example
To retrieve only the first and last names of all patients, apply the SELECT function to the first_name and last_name columns

SQL SELECT Using WHERE Clause Example
To retrieve information about female patients, apply the SELECT * function directly to the table followed by the WHERE subquery to filter out the value 'F' from the gender column.

SQL SELECT From Specific Column Using WHERE Clause Example
To retrieve the contact numbers of male patients, apply the SELECT function to the contact_number column followed by the WHERE subquery to filter out the value 'M' from the gender column.
