1501. Countries You Can Safely Invest In

https://leetcode.com/problems/countries-you-can-safely-invest-in

Description

Table Person:

+----------------+---------+
| Column Name    | Type    |
+----------------+---------+
| id             | int     |
| name           | varchar |
| phone\_number   | varchar |
+----------------+---------+
id is the primary key for this table.
Each row of this table contains the name of a person and their phone number.
Phone number will be in the form 'xxx-yyyyyyy' where xxx is the country code (3 characters) and yyyyyyy is the phone number (7 characters) where x and y are digits. Both can contain leading zeros.

Table Country:

+----------------+---------+
| Column Name    | Type    |
+----------------+---------+
| name           | varchar |
| country\_code   | varchar |
+----------------+---------+
country\_code is the primary key for this table.
Each row of this table contains the country name and its code. country\_code will be in the form 'xxx' where x is digits.

Table Calls:

A telecommunications company wants to invest in new countries. The company intends to invest in the countries where the average call duration of the calls in this country is strictly greater than the global average call duration.

Write an SQL query to find the countries where this company can invest.

Return the result table in any order.

The query result format is in the following example:

ac

Last updated

Was this helpful?