Deprecated: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/sqldump/public_html/config.php on line 184

Warning: mysql_query(): Access denied for user ''@'localhost' (using password: NO) in /home/sqldump/public_html/config.php on line 184

Warning: mysql_query(): A link to the server could not be established in /home/sqldump/public_html/config.php on line 184
SQL SELECT tutorial and database select query examples

SQL statement: SELECT

The SQL SELECT statement is used to retrieve data from an SQL database table. This is perhaps the most commonly used SQL command and usually the best place to start for somebody getting to grips with SQL queries.

We'll start with a standard SQL SELECT query using the same table we saw in the previous tutorial:

SELECT FirstName, LastName, EmailAddress from Customers

This is a simple SELCT query which retrieves just the first name, last name and email address of every customer in the 'Customers' table.

If you wanted to select ALL data from the Customers table, you could simply run this command

SELECT * from Customers

Where the asterisk (*) returns ALL columns instead of just first name, last name and email address

It is important to note that field names and table names are case sensitive

Back to table of contents