Using different types of select statements with practical examples

In this article ,Let us see more examples on select statements.We will see different types of select statement usage.

SELECT WHERE :

Where clause is used to filter records

EXAMPLE:-

                              SELECT * from Users where UserName='Raja‘
                        

Select and- :

Used to filter records based on more than one condition

EXAMPLE:-

                             SELECT * from Users where paddress='sholinganallur' and city='chennai'

                        

Select or- :

Used to filter records based on more than one condition

EXAMPLE:-

                              SELECT * from Users where paddress='sholinganallur' or paddress='Gopalapuram'

                        

Select not :

Used to filter records based on Not condition

EXAMPLE:-

                          SELECT * from Users where not paddress = 'sholinganallur' 
                        

Select order by:

It is used to sort the records either ascending or descending

EXAMPLE:-

                     SELECT * from Users order by paddress desc
                        

AGGREGATE FUNCTIONS USING SELECT STATEMENT :

COUNT : EXAMPLE:-

                          SELECT count(*) from Users
                        

AVERAGE : EXAMPLE:-

                          SELECT AVG(marks) from StudentMarks
                        

SUM : EXAMPLE:-

                          SELECT SUM(marks) from StudentMarks