반응형
Using our monsters table with the following schema:
monsters table schema
- id
- name
- legs
- arms
- characteristics
return the following table:
** output schema**
- name
- characteristics
Where the name is the original string repeated three times (do not add any spaces), and the characteristics are the original strings in reverse (e.g. 'abc, def, ghi' becomes 'ihg ,fed ,cba').
Solution:
SELECT
REPEAT(name,3) AS name,
REVERSE(characteristics) AS characteristics
FROM
monsters
Result:
name | characteristics |
CyrilCyrilCyril | yllems ,gib |
TinyTinyTiny | duol ,yknits ,llams |
NiallNiallNiall | tnelutalf |
UmphUmphUmph | ytsan ,citoidi |
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
SQL Basics: Raise to the Power (0) | 2022.06.09 |
---|---|
BASICS: Length based SELECT with LIKE (0) | 2022.06.08 |
SQL Basics - Position (0) | 2022.06.06 |
Register for the Party (SQL for Beginners #3) (0) | 2022.06.05 |
SQL Grasshopper: Select Columns (0) | 2022.06.05 |