.mode list
.separator ""
.output index.html
WITH raw AS (
SELECT
value AS country
FROM json_each(readfile('countries.json'))
),
rows AS (
SELECT
printf(
'
| %s | %s | %s | %s | %s |
',
json_extract(country, '$.translations.deu.common'),
json_extract(country, '$.population'),
json_extract(country, '$.capital[0]'),
json_extract(country, '$.tld[0]'),
json_extract(country, '$.timezones')
) AS row_html
FROM raw
ORDER BY json_extract(country, '$.translations.deu.common')
)
SELECT
'
Countries
Countries
| Name (DE) | Population | Capital | TLD | Timezones |
'
UNION ALL
SELECT row_html FROM rows
UNION ALL
SELECT
'
';
.output stdout