how can i calculate the number of students with age > x in sql? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can i calculate the number of students with age > x in sql?

26th Sep 2017, 6:34 PM
Mohamed Hussien
Mohamed Hussien - avatar
4 Answers
+ 3
SELECT COUNT(*) FROM students WHERE age > x
26th Sep 2017, 6:42 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
+ 9
Try: SELECT COUNT(*) FROM STUDENTS WHERE AGE > x
26th Sep 2017, 6:44 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
you can use alias as well for the count(*): SELECT COUNT(*) AS 'Total Students' FROM students WHERE age > x
19th Nov 2017, 8:04 PM
RAK
+ 1
SELECT COUNT(*) [TotalStudents] FROM students WHERE age > x
26th Sep 2017, 9:31 PM
Rachit