Question

if you do not have the world schema you can obtain the scripts to create the...

  1. if you do not have the world schema you can obtain the scripts to create the database schema from https://dev.mysql.com/doc/index-other.html

Queries

  1. Write a SQL query that shows all the columns in the country table for the North America region. The results need to be sorted in ascending order by population.
  1. Write a SQL query that shows the unique regions in the country table except for the regions from the continent of Oceania. The results need to be sorted in ascending order by region.
  1. Write a SQL query that shows the unique language from the Countrylanguage table where the percentage is between 1.0 and 5.0.
  1. Write a SQL query that shows the Name, Continent, Surface Area, LocalName where the LocalName ends with the word ‘Island’ and the surface area is greater than 100.
  1. Write a SQL query that shows the country name of countries that have missing values for IndepYear and GNPOld.
  1. Write a SQL query that shows the maximum population with an alias of Maxpopulation and minimum population with an alias of MinPopulation for the North America region.
  1. Write a SQL query that shows each region once and the total number of countries in the region with an alias of TotalCountries and the total population with an alias of TotalPopulation in that region. The results should be sorted in ascending order by region.
  1. Write a SQL query that shows the country name once and shows the number of cities in that country. The number of cities in the country is from the City table and should have an alias of NumberofCity.
  1. Write a SQL subquery that shows the unique region names where the languages spoken are English, French or German.
  1. Write a SQL query that shows the country name, region, language for the Caribbean region.
  1. Write a SQL query that shows the country name and number of official languages with an alias NumberOfficial. Please note the condition is asking for the count where IsOfficial is true. Also, the results need to be sorteed by number of oficial language(NumberOficial) in descending order.
  1. Write a SQL query that shows the Country Name and number of official language with alias NumberOfficial. Plese note the condition is asking for the count where IsOfficial is true.Also, the results should show only if the count number of official languages is greater than 2. The results need to be sorted by number of official language(NumberOffcial) in descending order.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answered 1-7 SQL queries

1.Write a SQL query that shows all the columns in the country table for the North America region. The results need to be sorted in ascending order by population.

SELECT *FROM country WHERE continent = 'North America' ORDER BY population ASC;

2.Write a SQL query that shows the unique regions in the country table except for the regions from the continent of Oceania. The results need to be sorted in ascending order by region.

SELECT * FROM country ORDER BY region ASC

EXCEPT

SELECT * FROM country where continent = 'Oceania';

3.Write a SQL query that shows the unique language from the Countrylanguage table where the percentage is between 1.0 and 5.0.

SELECT DISTINCT language from countrylanguages where percentage BETWEEN 1.0 AND 5.0;

4.Write a SQL query that shows the Name, Continent, Surface Area, LocalName where the LocalName ends with the word ‘Island’ and the surface area is greater than 100.

SELECT name,continent, surface_area,local_name from country where local_name LIKE 'Island%' AND surface_area>100;

5.Write a SQL query that shows the country name of countries that have missing values for IndepYear and GNPOld.

SELECT name FROM country where independence_year IS NULL OR gnp_old IS NULL;

6.Write a SQL query that shows the maximum population with an alias of Maxpopulation and minimum population with an alias of MinPopulation for the North America region.

SELECT Max(population) as Maxpopulation, Min(population) as Minpopulation from country where continent = 'North America';

7.Write a SQL query that shows each region once and the total number of countries in the region with an alias of TotalCountries and the total population with an alias of TotalPopulation in that region. The results should be sorted in ascending order by region.

SELECT region, Count(*) as TotalCountries, Sum(population) as TotalPopulation GROUP BY region ASC;

Add a comment
Know the answer?
Add Answer to:
if you do not have the world schema you can obtain the scripts to create the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1.If you do not have the world schema you can obtain the scripts to create the...

    1.If you do not have the world schema you can obtain the scripts to create the database schema from https://dev.mysql.com/doc/index-other.html Queries 1. Write a SQL subquery that shows the unique region names where the languages spoken are English, French or German. 2. Write a SQL query that shows the country name, region, language for the Caribbean region 3. Write a SQL query that shows the country name once and shows the number of cities in that country. The number of...

  • Need MySql commands for Use a UNION statement. Display the address ID, address, and district from...

    Need MySql commands for Use a UNION statement. Display the address ID, address, and district from the address table where the district is California or Alberta. Display the address ID, address, and district only from the address table where the address contains Jol. Display the language ID and name from the language table and the film ID from the film table. Display all languages whether they have an associated film or not. Order results by language ID in ascending order....

  • You have been asked to create a query that will join the Production.Products table with the...

    You have been asked to create a query that will join the Production.Products table with the Production.Categories table. From the Products table show the product name and unit price. From the Categories table show the category name and description. For the query sort by two columns: first by category name in ascending order and then by unit price in descending order. Provide the full SQL statement for the answer. TSQLV4

  • Write SQL to create a table called City in your account. The schema of the table...

    Write SQL to create a table called City in your account. The schema of the table is listed below. You must define the data types and not null constraint (if needed) of every column and all the primary key and foreign key constraints for the table. No screenshot needed for this question. City (Name, Country, Population, Capital). Name: the name of the city. Text string with maximum 50 characters. Must not be null. Country: the name of the country where...

  • pls help me with these SQL questions Here are tables TEAM table Task 10 (4 marks)...

    pls help me with these SQL questions Here are tables TEAM table Task 10 (4 marks) Write an SQL statement to display fan categories, the number of tickets in each category the fan bought (change the alias to "NUMBER OF TICKETS PURCHASED") along with the sum of prices (change the alias to TOTAL PRICES') in each category the fans paid. Sort the result by total price in an ascending order. Task 11 (5 marks) Write an SQL statement to display...

  • Assume you have a table with the following information for all countries. CCODE   CNAME           CONTINENT   LANGUAGE    POPULATION  &nbsp

    Assume you have a table with the following information for all countries. CCODE   CNAME           CONTINENT   LANGUAGE    POPULATION      LAND        WATER 1       Afghanistan     AS          fa          30419928.00     652230      NULL 2       Albania         EU          sq          3002859.00      27398       1350 3       Algeria         AF          ar          35406303.00     2381741     NULL ��  ��  ��  ��  ��  ��  �� Use this table to answer Q1-Q10 (1 Point Each). Answer each question as best as possible.   Show your work if you need to take multiple steps to answer a problem. Partial answers will count. A. Write a SQL query to answer: What is the average population of countries who speak English ('en') and whose name start and end with 'a'.

  • SQL Queries – in this assignment you will be asked to create several SQL queries relating...

    SQL Queries – in this assignment you will be asked to create several SQL queries relating to the Sakila database that we installed in class. You may freely use DBeaver to create these queries, but I will expect your solution to show me the SQL code to answer or complete the tasks below. Write a query that produces the last name, first name, address, district, and phone number for every customer in the customer table. (You don’t need to include...

  • QUESTIONS Q01: Use the comment feature of SQL to print your full name, AUID and username in three separate lines at the top of the script file. From this point onwards, you should use the comment fea...

    QUESTIONS Q01: Use the comment feature of SQL to print your full name, AUID and username in three separate lines at the top of the script file. From this point onwards, you should use the comment feature to separate your answers for each question. (0.2 mark) Q02: Write a SQL statement to retrieve all the rows from the Product table. All the columns should be renamed with proper spacing using the alias feature. For example, the UnitPrice column should be...

  • Write a SQL Query that lists the top 20 airlines with the highest number of domestic...

    Write a SQL Query that lists the top 20 airlines with the highest number of domestic routes. A route is considered domestic for an airline if both the source and destination airports are located in the same country the airline is located in. The query must return airline id, airline callsign, country, and count of domestic routes. Data Architecture The following diagram shows the relationships between the data files in the dataset. Note: You may need to maximize the text...

  • 4. Consider the following schema for an online streaming service, where users are allowed to play...

    4. Consider the following schema for an online streaming service, where users are allowed to play (stream) songs performed by different artists. Primary and foreign key constraints are also listed for the schema of each table. User (ID, Password, Name, Location) Primary key = ID Artist (ID, Name, Birthyear) Primary key = ID Song (ID, Title, Album, ArtistID) Primary key = ID Song(ArtistID) references Artist(ID) Play (ID, UserID, SongID, Timestamp) Primary key = ID Play(UserID) references User(ID) Play(SongID) references Song(ID)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT