From the JSONB attributes, show each book's title, its format, and its pages as an int. Columns: title, format, pages. Order by id.
From the JSONB attributes, show each book's title, its format, and its pages as an int. Columns: title, format, pages. Order by id.
Answer
SELECT title, attributes->>'format' AS format, (attributes->>'pages')::int AS pages FROM books ORDER BY id;