Challenge: 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_profilestable. - Use PostgreSQL JSON operators (
->and->>) to access the nestedcityfield inside theaddressobject in theprofile_datacolumn. - Filter for rows where the
address.cityvalue is'Springfield'. - Return the
user_idandprofile_datacolumns for all matching users.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 6. ChapterΒ 3
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 2.86
Challenge: 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_profilestable. - Use PostgreSQL JSON operators (
->and->>) to access the nestedcityfield inside theaddressobject in theprofile_datacolumn. - Filter for rows where the
address.cityvalue is'Springfield'. - Return the
user_idandprofile_datacolumns for all matching users.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 6. ChapterΒ 3
single