Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Find Users by City | Section
Functions in SQL
Sectionย 1. Chapterย 33
single

single

bookChallenge: Find Users by City

Swipe to show menu

Task

Swipe to start coding

Write a query to find users whose address city in the profile_data JSONB column is 'New York' using PostgreSQL JSON operators.

  • Query the user_profiles table.
  • Use PostgreSQL JSON operators (-> and ->>) to access the nested city field inside the address object in the profile_data column.
  • Filter for rows where the address.city value is 'Springfield'.
  • Return the user_id and profile_data columns for all matching users.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Sectionย 1. Chapterย 33
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt