나는 이렇게 학습한다/Algorithm & SQL

SQL Basics: Simple MIN / MAX

daco2020 2022. 5. 24. 08:27
반응형

or this challenge you need to create a simple MIN / MAX statement that will return the Minimum and Maximum ages out of all the people.

people table schema

  • id
  • name
  • age

select table schema

  • age_min (minimum of ages)
  • age_max (maximum of ages)

 

 

Solution:

SELECT 
  MIN(age) AS age_min,
  MAX(age) AS age_max 
FROM 
  people

 

Result:

age_min age_max
11 99

 

 

반응형

'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글

Grasshopper - Check for factor  (0) 2022.05.26
SQL Basics: Maths with String Manipulations  (0) 2022.05.25
SQL Basics: Simple JOIN  (0) 2022.05.23
Beginner Series #2 Clock  (0) 2022.05.22
SQL Basics: Simple SUM  (0) 2022.05.21