The syntax for the SQL SELECT statement is:
Select all fields from one table example:
How to use the SQL SELECT statement to select all fields from a table.
SELECT columns * FROM tables WHERE predicates;
Select all fields from one table example:
How to use the SQL SELECT statement to select all fields from a table.
SELECT * FROM employees WHERE city = 'Delhi';In this SQL SELECT statement, we've used * to signify that we wish to view all fields from the employees table where the employee resides in Delhi.
Selecting individual fields from one table example:
You can also use the SQL SELECT statement to select individual fields from the table, as opposed to all fields from the table. For example:
You can also use the SQL SELECT statement to select individual fields from the table, as opposed to all fields from the table. For example:
SELECT name, city, state FROM employees WHERE emp_id > 100;This SQL SELECT statement would return only the name, city, and state fields from the employees table where the emp_id value is greater than 100.
Select fields from multiple tables example:
You can also use the SQL SELECT statement to retrieve fields from multiple tables.
SELECT orders.order_id, customers.name FROM customers INNER JOIN orders ON customers.customer_id = orders.customer_id;This SQL SELECT statement joins two tables together to gives us a result set that displays the order_id and customer name fields where the customer_id value existed in both the customers and orders table.
HELP: What Is SQL INSERT Statement And How To Us
HELP: What Is SQL UPDATE Statement And How To Use