PostgreSQL - JSON and JSONBWhich of the following is the correct way to declare a JSON column in a PostgreSQL table?ACREATE TABLE data (info XML);BCREATE TABLE data (info TEXT[]);CCREATE TABLE data (info VARCHAR);DCREATE TABLE data (info JSON);Check Answer
Step-by-Step SolutionSolution:Step 1: Identify JSON data type syntaxPostgreSQL uses the JSON or JSONB data type to store JSON data.Step 2: Check each optionOnly CREATE TABLE data (info JSON); uses JSON type correctly; others use unrelated types.Final Answer:CREATE TABLE data (info JSON); -> Option DQuick Check:JSON column = JSON type [OK]Quick Trick: Use JSON or JSONB type for JSON columns [OK]Common Mistakes:Using TEXT[] or VARCHAR for JSON dataConfusing JSON with XML data typeMissing JSON keyword in column definition
Master "JSON and JSONB" in PostgreSQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PostgreSQL Quizzes Aggregate Functions and GROUP BY - GROUPING SETS for multiple groupings - Quiz 5medium Aggregate Functions and GROUP BY - GROUP BY single and multiple columns - Quiz 8hard Aggregate Functions and GROUP BY - Array aggregation with ARRAY_AGG - Quiz 7medium Common Table Expressions - Why CTEs matter in PostgreSQL - Quiz 15hard Full-Text Search - Search configuration and languages - Quiz 4medium JSON and JSONB - Indexing JSONB with GIN - Quiz 13medium Joins in PostgreSQL - LATERAL join for correlated subqueries - Quiz 13medium Set Operations and Advanced Queries - Conditional INSERT with ON CONFLICT - Quiz 15hard Subqueries in PostgreSQL - Subqueries with EXISTS - Quiz 3easy Window Functions in PostgreSQL - PARTITION BY for grouping windows - Quiz 14medium