← Back to the query

How to query the data

Example

Countries with more than 300,000 APNIC users and a terrestrial license

SELECT country_name, apnic_users FROM countries
WHERE apnic_users > 300000 AND terrestrial_license = 'YES'
ORDER BY apnic_users DESC

This query gives the country name and the amount of APNIC users from all countries with more than 300,000 estimated APNIC users and a terrestrial license, sorted by user numbers, largest first.

Overview

Columns and tableSELECT * (all columns) or SELECT country_name, apnic_users FROM countries
ConditionsWHERE with = <> < > <= >=, combined with AND OR NOT and brackets
Lists and textcountry_code IN ('SY', 'IR'); current_pops LIKE '%sfiabgr1%' (% = any text)
Empty valuesIS NULL, IS NOT NULL
Sort and limitORDER BY apnic_users DESC (ASC: smallest first), LIMIT 10
Count and averageCOUNT(*) SUM() AVG() MIN() MAX() ROUND(x, 1), per group with GROUP BY continent_code
Combine tablesFROM countries c JOIN mlab m ON m.country_code = c.country_code (LEFT JOIN: also rows without partner)
Name a resulta.users AS users_on_license_day

Additional Information

Examples

Countries without a terrestrial license, but with Starlink IP addresses

SELECT country_name, license_status, ipv4_addresses, current_pops, apnic_users
FROM countries
WHERE terrestrial_license = 'NO' AND ip_provisioned = 'current'
ORDER BY apnic_users DESC

Countries with APNIC user data before official license

SELECT c.country_name, c.terrestrial_license_date,
       MIN(a.date) AS first_users_day, MAX(a.users) AS max_users_before_license
FROM countries c JOIN apnic a ON a.country_code = c.country_code
WHERE a.users > 0 AND a.date < c.terrestrial_license_date
GROUP BY c.country_code
ORDER BY c.country_name

M-Lab Measurements per month in Syria

SELECT substr(date, 1, 7) AS month, SUM(tests) AS tests, 
          ROUND(AVG(minrtt_median), 1) AS mean_daily_median_minrtt_ms 
FROM mlab
WHERE country_code = 'SY'
GROUP BY month
ORDER BY month

Active prefixes of Sudan per PoP

SELECT pop, COUNT(*) AS prefixes, SUM(ipv4_addresses) AS ipv4_addresses, SUM(ipv6_56_prefixes) AS ipv6_56_prefixes
FROM prefixes
WHERE country_code = 'SD' AND active = 'YES'
GROUP BY pop

Tables and columns

Every table has the column country_code (e.g. 'DE') to combine them.

Loading...