Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
statistics
drop table if exists my_table; create table my_table(id serial primary key, event_id integer, answers jsonb); insert into my_table (event_id, answers) values (10, '{"colores": ["Rojo", "Verde", "Azul"]}'::jsonb), (10, '{"colores": ["Amarillo", "Verde"]}'), (10, '{"colores": ["Azul"]}'), (10, '{"maderas": ["pino"]}'); SELECT jsonb_array_elements_text(answers->'colores') AS colores, count(id) FROM my_table WHERE event_id = 10 GROUP BY colores;
run
|
edit
|
history
|
help
0
book suggestion
Assignment 1(SET A)
asd
PostreSQL: Today's Date/Time
nested array to table
Professional Networking Social Media Website SQL Analysis
Webiste SQL Analysis
Joins and Case
Movie Rating SQL Analysis Project
Q2