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 | JSON Functions
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Functions in SQL

bookChallenge: Find Users by City

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

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 6. ChapterΒ 3
single

single

Ask AI

expand

Ask AI

ChatGPT

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

close

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Β 6. ChapterΒ 3
single

single

some-alt