Select Command in SQL

Select Statment In SQL

Select command is used to retrieve the data form SQL database and return a set of record in shape of table. Select command is used with FROM keyword. We can also use WHERE, HAVING, DISTINCT ORDER BY clause which are discuses in detail in next tutorials. The syntax of select command is :
SELCT column1, column2..... FROM table_name;
You can retrieve the data form one column or more then one column or form all column. If you specify one or more then one column name the data of the given column will be diplay.
For example
SELECT name FROM student_Info;
Where name is column name and student_info is file name.
if we have a Table with following record:

Name Marks Result Grade
Mr. Muneer 500 Pass A
Mr. Naweed 300 Pass B
Mr.tauqeer 450 Pass A
Mr. Jalil 200 Fail Fail

Then The result of above Statement is :
Name
Mr. Muneer
Mr. Naweed
Mr.tauqeer
Mr. Jalil
You can also retrieve the data form more then one column then place a comma ( , ) between each column name
For example
SELECT name , Marks FROM student_Info
The result of above Statement is :

Name Marks
Mr. Muneer 500
Mr. Naweed 300
Mr.tauqeer 450
Mr. Jalil 200

You can also retrieve the data form all column for this purpose use " * "' instead of column name.
For example
SELECT * FROM student_Info
The result of above Statement is :

Name Marks Result Grade
Mr. Muneer 500 Pass A
Mr. Naweed 300 Pass B
Mr.tauqeer 450 Pass A
Mr. Jalil 200 Fail Fai