ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

SQL SELECT Statement

sqltuts

The SELECT statement tells what is to be returned. ‘*’means all the columns from all tables in the from statement are to be returned.

 

Syntax:

 

  1. SELECT <field1>,<field2>
  2. FROM <table_name>;

 

For example, we have this table Employee:

Employee_id First_name Last_name sex
123 Mack Johnson male
124 Jack Obama male
125 King Khan male

 

Now, we want to select two columns Employee_id and First_name:

 

  1. SELECT Employee_id,First_name FROM Employee;

 

This would give the following result:

Employee_id First_name
123 Mack
124 Jack
125 King

 

  1. SELECT * FROM Employee;

The above command would display the whole table.

Facebook Comments

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!