Esta semana vamos a deshacer lo que la gente suele hacer y vamos a convertir una tabla en un objeto JSON VARIANT.
Aquí tenemos una tabla con información sobre un conjunto de superhéroes, tu trabajo es convertir esta tabla en un objeto JSON VARIANT.
Aquí está el código de inicio:
CREATE OR REPLACE TABLE week_14 ( superhero_name varchar(50), country_of_residence varchar(50), notable_exploits varchar(150), superpower varchar(100), second_superpower varchar(100), third_superpower varchar(100)
);
INSERT INTO week_14 VALUES ('Superpig', 'Ireland', 'Saved head of Irish Farmer\'s Association from terrorist cell', 'Super-Oinks', NULL, NULL); INSERT INTO week_14 VALUES ('Señor Mediocre', 'Mexico', 'Defeated corrupt convention of fruit lobbyists by telling anecdote that lasted 33 hours, with 16 tangents that lead to 17 resignations from the board', 'Public speaking', 'Stamp collecting', 'Laser vision'); INSERT INTO week_14 VALUES ('The CLAW', 'USA', 'Horrifically violent duel to the death with mass murdering super villain accidentally created art installation last valued at $14,450,000 by Sotheby\'s', 'Back scratching', 'Extendable arms', NULL); INSERT INTO week_14 VALUES ('Il Segreto', 'Italy', NULL, NULL, NULL, NULL); INSERT INTO week_14 VALUES ('Frosty Man', 'UK', 'Rescued a delegation of data engineers from a DevOps conference', 'Knows, by memory, 15 definitions of an obscure codex known as "the data mesh"', 'can copy and paste from StackOverflow with the blink of an eye', NULL);
Resultado
Recuerda que si deseas participar:
- Regístrate como miembro de Frosty Friday. Puedes hacerlo haciendo clic en la barra lateral y luego yendo a «REGISTRARSE» (ten en cuenta que unirte a nuestra lista de correo no te proporcionará una cuenta de Frosty Friday).
- Publica tu código en GitHub y asegúrate de que sea de acceso público (consulta nuestra guía si no sabes cómo hacerlo).
- Publica la URL en los comentarios del desafío.
Si tienes alguna pregunta técnica que te gustaría plantear a la comunidad, puedes hacerlo aquí, en nuestro hilo dedicado a estos retos.
Deja una respuesta
Lo siento, debes estar conectado para publicar un comentario.