All problems

The Savings Roster

easySQLFilteringSorting

Northline Bank is mailing a savings-rate promotion, and it can only go to people who already hold a savings account — sending it to a checking-only customer advertises a rate they cannot get. The mail house wants the names and the branch cities, and nothing else.

customers — one row per account holder at Northline. account_type is either checking or savings; city is the branch city the account belongs to.

id name account_type city
1 Farah Idris checking Chicago
2 Grant Boyle savings Miami
3 Hana Suzuki checking Chicago
4 Ibrahim Njoku savings Miami
5 Jade Wu checking Seattle

The table already exists in the database — there is nothing to create or load.

Task: Write a query that returns two columns, name and city, for every customer holding a savings account, sorted alphabetically by name. Checking customers must not appear.

Example output — shape only, on invented customers. If the bank's savings book held just two people, you would get:

name city
Marisol Vega Denver
Tobias Renner Portland

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…