Question

Using the World database, how many regions are in the continent of Antarctica?  Display this number as “Number of Re...


Using the World database, how many regions are in the continent of Antarctica?  Display this number as “Number of Regions”.  Display the name of the continent as ‘Continent’.  Also display the grand total surface area as “Total Surface Area”

Transcribed: World Table Relationships country Code CHAR(3) Name CHAR(52) city countrylanguage Continent ENUM(...) ID INT CountryCode CHAR(3) (FK) Name CHAR(35) Region CHAR(26) Language CHAR(30) SurfaceArea FLOAT(10,2) CountryCode CHAR(3) (FK) IsOfficial ENUM('T', 'F') IndepYear SMALLINT District CHAR(20) Percentage FLOAT(4,1) Population INT Population INT LifeExpectancy FLOAT(3,1) GNP FLOAT(10,2) GNPOID FLOAT(10,2) LocalName CHAR(45) GovernmentForm CHAR(45) HeadOfState CHAR(60) Capital INT Code2 CHAR(2)

Answer

SQL is the language that is used to communicate with the database. With the help of SQL, data can be inserted, updated, and manipulated.

 

Query: SELECT COUNT(Region) AS number_of_regions
FROM country
WHERE continent='Antarctica';

Explanation:

  • This query will display the number of regions in continent Antarctica,
  • Using COUNT keyword count of all the regions will be counted.
  • SELECT clause selects the column, FROM clause selects the table, and WHERE clause defines the condition.

Query: SELECT continents as continents 

FROM country;

Explanation:

  • In this query, the name of continents will be displayed with the column name as continents.
  • SELECT clause selects the column and FROM clause selects the table.

Query: SELECT SUM(surface_area) AS total_surface_area
FROM country;

Explanation:

  • This query will display the sum of the surface area of all continents.
  • SELECT clause selects the column and FROM clause selects the table.

 

Recent Questions