Hi! Could we please enable some services and cookies to improve your experience and our website?

Privacy & Cookie Policy.
SQL code copied to buffer
Sharpen your SQL skills with our interactive exercises and assessments!
Practice a wide range of SQL tasks, from basic queries to advanced techniques. Get immediate feedback on your solutions, helping you learn from mistakes and improve your skills. Boost your confidence for job interviews and real-world SQL applications.
RU PT
Task 2:
Write a SQL query to calculate the area of ​​China in square kilometers using geospatial functions. Round the final result to the nearest integer.
Output one column: area_sq_km — the area of ​​the country in square kilometers.

Use PostGIS (PostgreSQL) syntax to write your answer. Descriptions of tables are provided in the right pane.

Write your request in the field below and click the "Check it!" button.
Get hint
Copy code Clear editor
Explore over 350 diverse tasks on our platform.

Countries Database (PostGIS)

The Countries database is designed for geographic and geopolitical data analysis. It contains spatial information about countries and their capitals, suitable for GIS applications and spatial queries.

Table List:

countries - list of countries with geometry.
  • idunique record identifier (PK).
  • namecountry name.
  • bordercountry geometry (MultiPolygon, SRID 4326).
id name geom
1 France MultiPolygon(...) [SRID=4326]
  • PRIMARY KEY, btree (id)
capitals - list of capitals with location.
  • idunique record identifier (PK).
  • namecapital name.
  • country_idreference to country (FK).
  • locationcapital location (Point, SRID 4326).
id name country_id geom
1 Paris 1 Point(...) [SRID=4326]
  • PRIMARY KEY, btree (id)
  • FOREIGN KEY (country_id) REFERENCES countries(id)