--Anotaciones--
--JSON se agrego a postgresql como un tipo de dato
--Aparece por primera vez en la versión 9.2 postgresql
create table profiles(id serial primary key,profile Json);
insert into profiles(profile) values('{"name":"Mario","tech":["postgresql","ruby","elixir"]}');
insert into profiles(profile) values('{"name":"Jairo","tech":["Python","java","javascript"]}');
select * from profiles;
--Comprobar que el dato ingresado en la columna profile es un JSON
select json_array_elements(json_extract_path_text(profile,'tech')::JSON) from profiles;
select json_extract_path_text(profile,'name') from profiles;
select json_array_elements('["hello",1.3,"\u2603"]');
--Guardar un json de manera binaria
--Beneficio de guardar un documento de manera binaria velocidad en las operaciones y reducción de espacio
create table profiles_b(id serial primary key, profile JSONB);
insert into profiles_b(profile) values('{"name":"Hiro","tech":["postgresql","ruby","elixir"]}');
insert into profiles_b(profile) values('{"name":"Jairo","tech":["Spring","Python","ML"]}');