SQL SELECT Statement

Friday, October 28, 2011

tags SQL

The SELECT statement is used to select data from a database. The result is stored in a result table, called the result-set.  You can use the SELECT statement to query information from one ore more tables in a database.  Tables can be joined together to provide relational information.  When using the SELECT statement, you can either specify the fields (columns) or use '*' to indicate that the results should include all fields.  SQL is not case sensitive.   You can also use the keyword DISTINCT to only request a unique recordset.


SQL SELECT Syntax

SELECT column_name(s)
FROM table_name

or

SELECT *
FROM table_name

or

SELECT DISTINCT column_name(s)
FROM table_name


SQL SELECT Examples

SELECT LastName,FirstName FROM Customers

SELECT DISTINCT LastName FROM Customers

SELECT * FROM tbl_employees

employeeIDemployeeName
1000John Smith
1001Fred White
1002Jane Scott
1003Samuel Williams

Did you find the page informational and useful? Share it using one of your favorite social sites.

Recommended Books & Training Resources

Head First SQL: Your Brain on SQL A Learners Guide SQL Cookbook