Complete the code to extract the JSON object at key 'address' using the #> operator.
SELECT data [1] '{address}' FROM users;
The #> operator extracts a JSON object at the specified path as JSON, which is suitable for nested JSON extraction.
Complete the code to extract the text value at path '{contact, phone}' using the #>> operator.
SELECT data [1] '{contact,phone}' FROM users;
The #>> operator extracts the JSON value at the path and returns it as text, which is useful for getting string values.
Fix the error in the code to extract the JSON object at path '{details, age}' using the correct operator.
SELECT data [1] '{details, age}' FROM users;
The #> operator is correct for extracting a JSON object at a path given as a text array. The original code likely used an operator returning text or incorrect syntax.
Fill both blanks to extract the text value at path '{profile, email}' and alias it as user_email.
SELECT data [1] '{profile,email}' [2] user_email FROM users;
The #>> operator extracts text at the given path. The AS keyword aliases the column name.
Fill all three blanks to extract the JSON object at path '{settings, theme}', convert it to text, and alias it as theme_setting.
SELECT data [1] '{settings,theme}' [2] theme_setting FROM users WHERE data [3] '{settings,theme}';
Use #> to extract JSON, AS to alias the column, and ? to check if the JSON path exists in the data.