SQL Select Command


Prev Tutorial Next Tutorial

SQL Select Command

Select command is used to retrieved the data from the existing table in the database.

  • Using Select command you can retrieve all the records from the table in the database.
  • Using Select command you can retrieve specific records from the table "using where clause"

Syntax

	
select * from table_name;

Note: In the above syntax * represent all columns.

Example

	
select * from Employee;

Employee table

Using this table i will show you how to select employee record whose salary is greater than 30000.

emp_idnamesalary
101Amit24000
102Gaurav26000
103Hitesh35000
104Rahul34000
103Sultan54000

Example

SELECT emp_id, name FROM Employee

Result after using Select Command

emp_idname
101Amit
102Gaurav
103Hitesh
104Rahul
103Sultan

Select command with where clause

When you need to select some specific record from table you can use where clause with select command, in below example i will select those employee records who have more than 30000 salary.

Example

SELECT * from Employee
WHERE salary>30000;

Result after using Execute above query.

emp_idnamesalary
105Hitesh35000
102Rahul34000
103Sultan54000

Prev Tutorial Next Tutorial

Advertisements




Facebook Likes

Advertisements