/    /  DBMS – SQL select command

SQL Select Command

 

List of Select Clauses

  1. Distinct                          10. String
  2. All                                  11. Between
  3. Arithmetic                      12. Set
  4. Relational                      13. Group-by
  5. Order-by                        14. Having
  6. And                                15. Sub-queries
  7. Aggregate
  8. Natural join
  9. Rename

 

Let us take the following table STUD and understand better with the help of some examples

 

SNoSNameAge Qual DOB
21 Max15Btech15-01-2002
23Maggie15Btech15-01-2002
26Ben15Btech22-01-2002
28May18Btech10-08-2000
30Alex18Btech10-07-2000

 

Example 1:

Display all the ages of students.

Select  all  age  from  STUD;

Output :   

Age

                                               15

                                               15

                                               15

                                               18

                                               18

 

Example 2:

 

Display all the student numbers and names of students.

                                 Select SNo, SName  from STUD ;

 Output :

                                     SNo            SName

121             xyz             

                                     123             pqr            

                                     126             mnp          

                                     128             abc

130              jkl      

 

Reference:

SQL Select Command.