SQL Select Command
List of Select Clauses
- Distinct 10. String
- All 11. Between
- Arithmetic 12. Set
- Relational 13. Group-by
- Order-by 14. Having
- And 15. Sub-queries
- Aggregate
- Natural join
- Rename
Let us take the following table STUD and understand better with the help of some examples
SNo | SName | Age | Qual | DOB |
21 | Max | 15 | Btech | 15-01-2002 |
23 | Maggie | 15 | Btech | 15-01-2002 |
26 | Ben | 15 | Btech | 22-01-2002 |
28 | May | 18 | Btech | 10-08-2000 |
30 | Alex | 18 | Btech | 10-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
SQL Select Command.