Sql Select From

An sql select statement returns a set of data records from one or more data tables.
In this sql select tutorial we will use the sample table below for our sql select statement examples.

Our table sample is an ordinary users table that stores user's informations basically.


Users Table; tbl_users

id Name Email Password Age
1 John Doe johndoe@j.com e56Hdf-2 34
2 Jane Doe janedoe@j.com p59Hdf-2 32
2 Gary Doe garydoe@j.com y02Tdf-2 23

SQL Select Code

SELECT * FROM tbl_users

This sql query will return all the rows from users table.


Note that sql queries are not case sensitive.


Selecting specific columns from table

SELECT id,Name FROM tbl_users

In this sql query we only select id and user name from users table.

The result

id Name
1 John Doe
2 Jane Doe
2 Gary Doe

SQL SELECT Optimization Tips


SQL SELECT Code Samples