This tutorial could not be loaded.
Loading tutorial...
Interactive tutorial
Learn to store, query, validate, update, and index JSONB documents in PostgreSQL. Using a small product catalog, you will extract typed values, distinguish missing keys from JSON null, filter nested data, expand arrays, write JSONPath conditions, and choose indexes that match your queries. Complete the tutorial by combining these skills in a safe, transaction-based workflow.
Step 1 of 10
5 min
Choose JSONB and Build the Practice Catalog
Choose appropriate storage for product data, then build and verify a reproducible JSONB catalog in your local PostgreSQL database.
Step 2 of 10
5 min
Extract Nested Values with the Right Type
Extract top-level and nested JSONB values, choose JSONB or text results, and cast an extracted measurement for numeric use.
Step 3 of 10
5 min
Handle Missing Keys, Nulls, and Type Differences
Distinguish missing fields, JSON null, and SQL NULL, then guard a numeric extraction against varying JSONB value types.
Step 4 of 10
5 min
Filter with Containment and Existence Operators
Choose containment, existence, and extracted scalar conditions according to the JSONB question you need to answer.
Step 5 of 10
5 min
Turn JSONB Arrays into Relational Rows
Expand JSONB tag arrays into relational rows while controlling whether products with no emitted tags remain in the result.
Step 6 of 10
5 min
Express Nested Conditions with JSONPath
Select nested JSONB values and array elements with filtered JSONPath expressions and the `@?` operator, without expanding product rows.
Step 7 of 10
7 min
Update Documents Without Losing Unrelated Fields
Safely update and remove selected JSONB fields while preserving unrelated document content and restoring the practice catalog with a rollback.
Step 8 of 10
6 min
Validate the Document Shape You Depend On
Define a document-shape CHECK constraint that rejects missing required keys and incorrect JSON value types.
Step 9 of 10
7 min
Match Indexes to Your JSONB Queries
Select GIN or B-tree expression indexes that align with JSONB query operators, distinguish index-eligible JSONPath equality clauses from numeric-range conditions, and interpret local execution plans realistically.
Step 10 of 10
8 min
Complete a JSONB Catalog Workflow
Combine query design, transactional mutation, document-shape reasoning, and index selection in the product catalog.
Video Courses
Ideal for beginners
recommended
Thousands of online courses in video, ebooks and audiobooks.
To test your knowledge during online courses
Generated directly from your cell phone's photo gallery and sent to your email
Download our app via QR Code or the links below:.
+ 10 million
students
Free and Valid
Certificate
60 thousand free
exercises
4.8/5 rating in
app stores
Free courses in
video and ebooks