๋ฐ์ํ
1. ๋ชจ๋ ๋ ์ฝ๋ ์กฐํํ๊ธฐ |
[์ ๋ต ์ ์ด๋์]
๋๋ณด๊ธฐ
SELECT * from animal_ins order by animal_id;
2. ์ญ์ ์ ๋ ฌํ๊ธฐ |
[์ ๋ต ์ ์ด๋์]
๋๋ณด๊ธฐ
SELECT name, datetime from animal_ins order by animal_id desc;
3. ์ํ ๋๋ฌผ ์ฐพ๊ธฐ |
[์ ๋ต ์ ์ด๋์]
๋๋ณด๊ธฐ
SELECT animal_id, name from animal_ins where intake_condition='Sick' order by animal_id;
4. ์ด๋ฆฐ ๋๋ฌผ ์ฐพ๊ธฐ |
[์ ๋ต ์ ์ด๋์]
๋๋ณด๊ธฐ
SELECT animal_id, name from animal_ins where not intake_condition='Aged' order by animal_id;
5. ๋๋ฌผ์ ์์ด๋์ ์ด๋ฆ |
[์ ๋ต ์ ์ด๋์]
๋๋ณด๊ธฐ
SELECT animal_id,name from animal_ins order by animal_id;
6. ์ฌ๋ฌ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌํ๊ธฐ |
[์ ๋ต ์ ์ด๋์]
๋๋ณด๊ธฐ
SELECT
ANIMAL_ID,
NAME,
DATETIME
FROM
ANIMAL_INS
ORDER BY
NAME,
DATETIME DESC;
7. ์์ n๊ฐ ๋ ์ฝ๋ |
[์ ๋ต ์ ์ด๋์]
๋๋ณด๊ธฐ
SELECT
NAME
FROM
ANIMAL_INS
ORDER BY
DATETIME
LIMIT 1;
๋ฐ์ํ
'โ๏ธ ์ด๋ก > ๋คํธ์ํฌ, ๋ฐ์ดํฐ๋ฒ ์ด์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค/์ฟผ๋ฆฌ๋ฌธ ์ฐ์ต] GROUP BY (0) | 2019.12.01 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค/์ฟผ๋ฆฌ๋ฌธ ์ฐ์ต] SUM, MAX, MIN (0) | 2019.12.01 |
[๋งํฌ] HTTP ์๋ฒ ์๋ต ์ฝ๋ (Response Code) ์ ๋ฆฌ_1 (0) | 2019.11.22 |
[Mysql/๊ฐ์ข] SQL Full Tutorial Course using MySQL Database (0) | 2019.11.21 |
[๋งํฌ/์นดํ24/์๊ฒฉ๋ฐ์คํฌํฑ์ฐ๊ฒฐ] ์๋์ฐ ์๋ฒ ์ ์ํ๊ธฐ ๊ฐ์ด๋ (0) | 2019.11.21 |