반응형
Given a demographics table in the following format:
** demographics table schema **
- id
- name
- birthday
- race
you need to return the same table where all text fields (name & race) are changed to the ascii code of their first byte.
e.g. Verlie = 86 Warren = 87 Horace = 72 Tracy = 84
Solution:
SELECT
id,
ASCII(name) AS name,
birthday,
ASCII(race) AS race
FROM
demographics
Result:
id | name | birthday | race |
1 | 68 | 2000-01-25 | 78 |
2 | 75 | 1978-06-17 | 65 |
3 | 76 | 1966-03-03 | 65 |
4 | 67 | 1963-08-20 | 65 |
5 | 74 | 1961-05-14 | 78 |
6 | 77 | 1974-04-13 | 65 |
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
On the Canadian Border (SQL for Beginners #2) (0) | 2022.06.02 |
---|---|
Easy SQL: Bit Length (0) | 2022.06.02 |
Easy SQL: Rounding Decimals (0) | 2022.05.30 |
Easy SQL: Moving Values (0) | 2022.05.29 |
Grasshopper - Terminal game move function (0) | 2022.05.29 |