The most commonly used SQL command is SELECT statement. SELECT statement is used to retrieve data from a table in the database .

Syntax 1 :

To retrieve all the columns and rows from a table we have to use the following syntax

SELECT * FROM table_name;

Syntax 2 :

If we want to retrieve the data from particular columns , then we use following syntax .

SELECT column_name,column_name, column_ name
FROM table_name;

Syntax 3 :

If we want retrieve particular rows and columns then we have to apply condition using WHERE keyword in SELECT statement . See the below syntax .

SELECT column_name,column_name, column_ name
FROM table_name WHERE condition .

Example 1:

Below query gives all the data from table.

SELECT * from student ;

Output :
STUDENT_IDSTUDENT_NAMESTUDENT_MOB_NOSTUDENT_ADREES
1hrithik5678655665india
2clement5678634854Russia
3mastaan4588989898soudhi
4wangdu3456564545korea
5maansingh9887768766india


Example 2:

Below query gives student_id , student_name from student table.

SELECT student_id , student_name from student ;

Output :
STUDENT_IDSTUDENT_NAME
1hrithik
2clement
3mastaan
4wangdu
5maansingh


Exampl : 3

To get particular rows we have to use WHERE keyword with condition as shown in below example .

SELECT * FROM student WHERE student_adrees = 'india';

Output :
STUDENT_IDSTUDENT_NAMESTUDENT_MOB_NOSTUDENT_ADREES
1hrithik5678655665india
5maansingh9887768766india

Remember , SQL Queries are case insensitive but data is case sensitive . Means ‘india’ is different from ‘INDIA’ .