SQL Commands : SELECT

 The SELECT command is used to fetch the data from a database table which returns this data in the form of a result table. It is the most used SQL statement. The basic syntax of the SELECT statement is as follows :
SELECT column_name1, column_name2, .... column_nameN FROM table_name;
At above, the column_name1, column_name2.... are the fields of a tables, whom values we want to fetch. And in order to fetch all the fields in a table, we are going to use following :
SELECT * FROM table_name;
Where the * ( asterisk ) is used as a wildcard.

For example consider the Below table employee :


Now the below statement will fetch only Employee Name, Salary and Address.
SELECT EmpName, Salary, Addr from employee;
The result would be :


We want to fetch all the fields of the students table, then we should use the following query.
SELECT * FROM students;
Output :



Next Topic :