SQL SELECT statement

SELECT statement in sql helps us select or retrieve data from table(s) in the relational database.

Using SELECT we can:

  • select all the data from the table
  • select particular row or coloumns from the table by applying WHERE clause.
  • select data in refined manner using GROUP BY and HAVING clause after WHERE clause.
  • apply aggregate functions like max, min, count, etc

For demonstration we will take help of tih_Corses table:

Course_ID Course_Name Professor Mode_of_Training
001 .Net Mukesh Tiwari Online and Offline
002 Java Rajneesh Shukla Online and Offline
003 ANSI SQL Rajneesh Shukla Online
004 Basics of Computer Shweta  Online

We will apply select statement on this table in various ways and see the result.



Applying SELECT * on table will fetch all the data (rows and coloumn) from the table.


Syntax of SELECT *

SELECT * FROM table_name;


SELECT * FROM tih_Courses;

On executing the the above query successfully, the entire data from the table 'tih_Courses' would be returned. 

SELECT columns

Suppose we only want to select particular columns from the table instead of all the data. We can easily do it using SELECT statement.



SELECT column1, column2,....,columnN FROM table_name;



From the table 'tih_Courses' we want to select all the course name and their respective professor.

SELECT Course_Name, Professor FROM tih_Courses;

On executing the above query we will get:

Course_Name Professor
.Net Mukesh Tiwari
Java Rajneesh Shukla
ANSI SQL Rajneesh Shukla
Basics of Computer Shweta 

We can further filter our SELECT query applying WHERE clause with it.

Like select only those courses whose professor is Rajneesh Shukla, etc.


We will learn about it in WHERE clause section of this tutorial.


Please Share this page
Views : 151
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!