Back to problems

SQL Aggregation Across Country/State/City/Zip Tables

SQL · NVIDIA · Medium

Problem You are given four relational tables: country, state, city, and zip. The zip table stores the population associated with each ZIP code. Create a SQL query that calculates the combined population for every city by adding the populations of all ZIP-code records assigned to that city. The result must contain: city_name total_population Join zip with city, and include state and country in the join path when the schema requires them. For this question, city names are…

Checking your access…