Note: SQL Query
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:
Results should be sorted in ascending order by country_name.
Note:
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
The output should be sorted in ascending order by country_name.
| country_name | total_domains |
|---|---|
| Azerbaijan | 7 |
| China | 6 |
| Colombia | 1 |