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

Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.



Recommended Books & Training Resources

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