blog.itcode.devblog.itcode.dev

[Programmers / MySQL] Level 1 Animal IDs and Names (59403)

The ANIMAL_INS table is a table containing information about animals that have entered an animal shelter. The ANIMAL_INS table structure is as follows, where ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, and SEX_UPON_INTAKE represent the animal's ID, species, intake date, condition at intake, name, and sex/neuter status, respectively.

[Programmers / MySQL] Level 1 Animal IDs and Names (59403)

The ANIMAL_INS table is a table containing information about animals that have entered an animal shelter. The ANIMAL_INS table structure is as follows, where ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, and SEX_UPON_INTAKE represent the animal's ID, species, intake date, condition at intake, name, and sex/neuter status, respectively.
RWB0104
@RWBwritten at 2021-12-15 14:58:28
Programmers

시리즈 모아보기

Programmers

30 / 78
RankLanguage Used
Level 1

🖼️ MySQL

🔗 Animal IDs and Names

The ANIMAL_INS table is a table containing information about animals that have entered an animal shelter. The ANIMAL_INS table structure is as follows, where ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, and SEX_UPON_INTAKE represent the animal's ID, species, intake date, condition at intake, name, and sex/neuter status, respectively.

NAMETYPENULLABLE
ANIMAL_IDVARCHAR(N)FALSE
ANIMAL_TYPEVARCHAR(N)FALSE
DATETIMEDATETIMEFALSE
INTAKE_CONDITIONVARCHAR(N)FALSE
NAMEVARCHAR(N)TRUE
SEX_UPON_INTAKEVARCHAR(N)FALSE

Write a SQL statement to retrieve the ID and name of every animal that entered the shelter, sorted by ANIMAL_ID. Running the SQL should produce the following output:

ANIMAL_IDNAME
A349996Sugar
A350276Jewel
A350375Meo
A352555Harley
A352713Gia
A352872Peanutbutter
A353259Bj

((the rest is omitted))

Retrieve the ANIMAL_ID and NAME of every animal. Sort the results in ascending order by ANIMAL_ID.

SQL

SELECT ANIMAL_ID, NAME FROM ANIMAL_INS ORDER BY ANIMAL_ID;
# Programmers# Algorithm# SQL# Level 1
ship
blog.itcode.dev

Notes from the π-th Alpaca

7.0.1
Developed by RWB since 2021.057th upgraded at 2026.08