[Programmers / MySQL] Level 1 Retrieve All Records (59034)
[Programmers / MySQL] Level 1 Retrieve All Records (59034)
The ANIMAL_INS table holds information about animals that have come into 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.
@RWBwritten at 2021-12-14 16:38:22
| Rank | Language Used |
|---|---|
| Level 1 | 🖼️ MySQL |
The ANIMAL_INS table holds information about animals that have come into 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.
| NAME | TYPE | NULLABLE |
|---|---|---|
| ANIMAL_ID | VARCHAR(N) | FALSE |
| ANIMAL_TYPE | VARCHAR(N) | FALSE |
| DATETIME | DATETIME | FALSE |
| INTAKE_CONDITION | VARCHAR(N) | FALSE |
| NAME | VARCHAR(N) | TRUE |
| SEX_UPON_INTAKE | VARCHAR(N) | FALSE |
Write an SQL statement that retrieves information for every animal that came into the shelter, ordered by ANIMAL_ID. Running the SQL should produce output like the following.
| ANIMAL_ID | ANIMAL_TYPE | DATETIME | INTAKE_CONDITION | NAME | SEX_UPON_INTAKE |
|---|---|---|---|---|---|
| A349996 | Cat | 2018-01-22 14:32:00 | Normal | Sugar | Neutered Male |
| A350276 | Cat | 2017-08-13 13:50:00 | Normal | Jewel | Spayed Female |
| A350375 | Cat | 2017-03-06 15:01:00 | Normal | Meo | Neutered Male |
| A352555 | Dog | 2014-08-08 04:20:00 | Normal | Harley | Spayed Female |
..omitted below
Query ANIMAL_INS, ordered by ANIMAL_ID.
SQL
SELECT * FROM ANIMAL_INS ORDER BY ANIMAL_ID;
# Programmers# Algorithm# SQL# Level 1
