SQL query is used to retrieve selected row or column from the database based on the given condition . It is also used to retrieve data from a table in database .
Syntax ->
Select expression from table_Name where clause ; // Expression indicate that column , which we want to retrieve
Optional Clause in Select Statement
Where clause -> Using this clause we can retrieve specified rows or columns .
Group By clause -> It is used to Group the elements and arranged them based on the specified condition and get the aggregate result .
Having clause -> It is used to select the group which come from the Group By clause .
Order By clause -> Used to get the data from which order either by increasing or decreasing .
**Student_name** **Student_Age** **Student_Id**
Mukesh 23 1
Ayush 24 2
Ravi 25 3
Now , Suppose you want to select all the name from table student
Select student_name from student ; // sql is not case sensitive so Select can be select also
Output -> Mukesh Ayush Ravi
Now if you want to select student age also then
select Student_name , Student_Age from student ;
Now if you want to select any specified column then you can do with the clauses i.e where , Group By , Having ect .
0 Comment(s)