sql:select
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
sql:select [2022/07/08 09:07] – 185.92.25.28 | sql:select [2022/07/08 09:12] (current) – 185.92.25.28 | ||
---|---|---|---|
Line 46: | Line 46: | ||
---- | ---- | ||
+ | ===== Fetch maximum age from a table ===== | ||
+ | |||
+ | <code sql> | ||
+ | SELECT MAX(age) | ||
+ | FROM Students; | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Fetch minimum age from a table ===== | ||
+ | |||
+ | <code sql> | ||
+ | SELECT MIN(age) | ||
+ | FROM Students; | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Fetch sum of ages from a table ===== | ||
+ | |||
+ | <code sql> | ||
+ | SELECT SUM(age) | ||
+ | FROM Students; | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Fetch average age from a table ===== | ||
+ | |||
+ | <code sql> | ||
+ | SELECT AVG(age) | ||
+ | FROM Students; | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Fetch average age for each gender ===== | ||
+ | |||
+ | <code sql> | ||
+ | SELECT AVG(age) | ||
+ | FROM Students | ||
+ | GROUP BY gender; | ||
+ | </ | ||
+ | |||
+ | ---- | ||
sql/select.1657271271.txt.gz · Last modified: 2022/07/08 09:07 by 185.92.25.28