Select Statement

Select Statement with asterisk (*) or Select "star" returns all of the columns in a table.

SELECT * FROM Table_Name

Ex:

SELECT *
FROM Customers

Results:

CustomerID FirstName LastName Address City State zip
1 Rob Johnson 1 York Rd New York NY 10013
2 Jessica Simmons 2 High St Maimi FL 33101
3 Tracy Baker 3 River Dr Chicago IL 60633
4 Tod Williams 4 Cabin Ln Denver CO 80210
5 Tammy Wilson 5 Peach St Seattle WA 98121
6 Mike Jones 6 Rice Rd Los Angeles CA 90009

 If you do not need to return all of the columns in your table you should specify the columns that you need to improve query performance.  Also, if you are using the SQL statement in an application listing your columns will help with troubleshooting your query.

SELECT Column1,

Column2,

Column3

FROM Table_Name


Ex:

SELECT
CustomerID,
FirstName,
LastName
FROM Customers

Results:

CustomerID FirstName LastName
1 Rob Johnson
2 Jessica Simmons
3 Tracy Baker
4 Tod Williams
5 Tammy Wilson
6 Mike Jones
Previous
Previous

SQL Video Playlist

Next
Next

Aliases