This is a verified interview question from Wells-fargo. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Country Domain Report" covers key patterns like System Design.
"Note: SQL Query ### Problem Generate a report listing countries with active domain registrations and the total number of domains per country for strategic planning and market analysis. The report should include: - country_name - The name of the country from where the domain was registered - total_domains - The total number of active domains registered from that country Results should be sorted in ascending order by country_name. Note: - Only include active domains in the result. ### Input The schema of the tables are as follows: **countries** | Name | Type | Constraints | Description | | --- | --- | --- | --- | | id | INT | PRIMARY KEY | The identifier of the country | | name | VARCHAR(255) | | The name of the country | **domains** | Name | Type | Constraints | Description | | --- | --- | --- | --- | | country_id | INT | FOREIGN KEY(country_id => countries.id) | The reference to the country | | name | VARCHAR(255) | | The name of the domain | | is_active | BOOLEAN | | The status of the domain | Sample Data Tables: **countries** id | name 1 | Azerbaijan 2 | Colombia 3 | China **domains** country_id | name | is_active 1 | angelfire.com | 1 1 | free.fr | 1 1 | google.cn | 1 1 | nationalgeographic.com | 1 1 | ovh.net | 1 1 | surveymonkey.com | 1 1 | twilpic.com | 1 2 | ameblo.jp | 1 2 | sourceforge.net | 1 3 | hc360.com | 1 3 | liveinternet.ru | 1 3 | squidoo.com | 1 3 | technorati.com | 1 3 | webnode.com | 1 3 | yahoo.co.jp | 1 1 | lund1.de | 0 1 | qq.com | 0 ### Output The output should be sorted in ascending order by country_name. | country_name | total_domains | | --- | --- | | Azerbaijan | 7 | | China | 6 | | Colombia | 1 |"
Join thousands of developers practicing for Wells-fargo.