Lecture 30
Lecture 30
Management
System
Lecture - 30
Order By Example
Q: Display the students’ data in the
ascending order of names
SELECT * from STUDENT
ORDER BY stName
Practice Query
Display the name and cgpa of
students for all those students
who are in second or above
semester in descending order of
names
Functions in SQL
Built-in functions are pre-written
programs to perform specific
tasks
Accept certain arguments and
return the result
Categories of Functions
Depending on the arguments and the
return value, categorized
– Mathematical (ABS, ROUND, SIN, SQRT)
– String (LOWER, UPPER, SUBSTRING, LEN)
– Date (DATEDIFF, DATEPART, GETDATE())
– System (USER, DATALENGTH, HOST_NAME)
– Conversion (CAST, CONVERT)
Using Functions
Lecture - 30