반응형
You received an invitation to an amazing party. Now you need to write an insert statement to add yourself to the table of participants.
participants table schema
- name (string)
- age (integer)
- attending (boolean)
NOTES:
- Since alcohol will be served, you can only attend if you are 21 or older
- You can't attend if the attending column returns anything but true
NOTE: Your solution should use pure SQL. Ruby is used within the test cases just to validate your answer.
Solution:
INSERT INTO
participants
VALUES
('Daco', 99, true);
--
SELECT
*
FROM
participants;
Result:
name | age | attending |
Alex | 22 | true |
Sam | 24 | true |
Daco | 99 | true |
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
SQL Basics: Repeat and Reverse (0) | 2022.06.07 |
---|---|
SQL Basics - Position (0) | 2022.06.06 |
SQL Grasshopper: Select Columns (0) | 2022.06.05 |
Remove String Spaces (0) | 2022.06.04 |
On the Canadian Border (SQL for Beginners #2) (0) | 2022.06.02 |