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 |
Select Command
Distinct clause with Select Command
Where clause In SQL
Logical Operator in SQL SELECT Statement
IN Operator in SQL
BETWEEN Operator in SQL
Use of Wildcards in SQL
LIKE Operator in SQL
ORDER BY Clause in SQL
GROUP BY Clause in SQL
HAVING Clause in SQL
ALIAS In SQL
AS Keyword In SQL
INSERT INTO Command In SQL
Inserting Record In to a Table Form an other Table In SQL
UPDATE Command in SQL
DELETE Command in SQL
AVG Function in SQL