Last active
June 6, 2021 04:44
-
-
Save JAForbes/994e5c6e4478c555dd93 to your computer and use it in GitHub Desktop.
Table literal in SQLite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select * from ( | |
-- define the column names | |
select 0 as a, 0 as b | |
-- join the definition row with all the values | |
union | |
-- define the values | |
values | |
(4,5), | |
(5,6), | |
(6,7), | |
(7,8), | |
(9,10), | |
(11,12) | |
) | |
-- skip the definition row | |
limit -1 offset 1; | |
--> /* | |
"a" "b" | |
=== === | |
"4" "5" | |
"5" "6" | |
"6" "7" | |
"7" "8" | |
"9" "10" | |
"11" "12" | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To create multiple rows, keep appending tuples:
Found this in the grammar for
SELECT
https://www.sqlite.org/lang_select.html