Bird
0
0

Which of the following is the correct way to declare a JSON column in a PostgreSQL table?

easy📝 Syntax Q12 of 15
PostgreSQL - JSON and JSONB
Which 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);
Step-by-Step Solution
Solution:
  1. Step 1: Identify JSON data type syntax

    PostgreSQL uses the JSON or JSONB data type to store JSON data.
  2. Step 2: Check each option

    Only CREATE TABLE data (info JSON); uses JSON type correctly; others use unrelated types.
  3. Final Answer:

    CREATE TABLE data (info JSON); -> Option D
  4. Quick 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 data
  • Confusing JSON with XML data type
  • Missing JSON keyword in column definition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes