Bird
0
0

Which of the following is the correct syntax to create a hash partitioned table in PostgreSQL?

easy📝 Syntax Q3 of 15
PostgreSQL - Table Partitioning
Which of the following is the correct syntax to create a hash partitioned table in PostgreSQL?
ACREATE TABLE sales PARTITION BY HASH (customer_id);
BCREATE TABLE sales PARTITION BY LIST (customer_id);
CCREATE TABLE sales PARTITION BY RANGE (customer_id);
DCREATE TABLE sales PARTITION BY COLUMN (customer_id);
Step-by-Step Solution
Solution:
  1. Step 1: Recall partitioning syntax

    PostgreSQL uses PARTITION BY HASH, LIST, or RANGE for partitioning methods.
  2. Step 2: Identify correct syntax for hash partitioning

    PARTITION BY HASH (column) is the correct syntax for hash partitioning.
  3. Final Answer:

    CREATE TABLE sales PARTITION BY HASH (customer_id); -> Option A
  4. Quick Check:

    Hash partition syntax = PARTITION BY HASH [OK]
Quick Trick: Use PARTITION BY HASH for hash partitioning syntax [OK]
Common Mistakes:
  • Using PARTITION BY COLUMN which is invalid
  • Confusing LIST or RANGE with HASH syntax
  • Omitting parentheses around partition key

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes