DML Take Home

3
Hands-on Quiz SQL – DDL and DML Instructions: Use the SmallWorld database structure to answer the following questions. Create SQL statements for the following data or database requirements. You don’t need to include the result set. Write your answer in a sheet of paper and submit before 12pm of March 18, 2009. Again: this exercise is meant to help you understand SQL. I highly recommend that you do the exercise yourself. Download world.sql from eclass. World.sql is actually a dump file of a database that creates tables and populates them with data. In mysql, create a database and name it smallworld. Upload world.sql into smallworld using the following commands. Mysql source ‘directory of file to upload’; Mysql source ‘world.sql’; If world.sql does not upload even with the file’s path included, don’t worry. All you need to do is copy world.sql in the bin directory of the MySql program. That should do the trick. Check smallworld. It should contain 3 tables and the tables must be populated with data already. If there are problems encountered, go figure out how to solve them. :p When it’s up and running, answer the questions below. Now, if you don’t want to use mysql and is confident with your mySql programming skills, use the tables below to answer the following questions.

description

Home Requirements.

Transcript of DML Take Home

Hands-on Quiz

Hands-on Quiz

SQL DDL and DML

Instructions: Use the SmallWorld database structure to answer the following questions. Create SQL statements for the following data or database requirements. You dont need to include the result set. Write your answer in a sheet of paper and submit before 12pm of March 18, 2009. Again: this exercise is meant to help you understand SQL. I highly recommend that you do the exercise yourself.

Download world.sql from eclass. World.sql is actually a dump file of a database that creates tables and populates them with data.

In mysql, create a database and name it smallworld.

Upload world.sql into smallworld using the following commands.

Mysql ( source directory of file to upload; Mysql ( source world.sql;

If world.sql does not upload even with the files path included, dont worry. All you need to do is copy world.sql in the bin directory of the MySql program. That should do the trick. (Check smallworld. It should contain 3 tables and the tables must be populated with data already. If there are problems encountered, go figure out how to solve them. :p When its up and running, answer the questions below.

Now, if you dont want to use mysql and is confident with your mySql programming skills, use the tables below to answer the following questions.

CountryLanguage

CountryCode

Language

IsOfficial

Percentage

Country

Code

Name

Continent

Region

SurfaceArea

IndepYear

LifeExpectancy

GNP

GNPOld

GovernmentForm

HeadOfState

Capital

Code2

City

ID

Name

CountryCode

District

Population

Answer the following questions. Remember that there are many ways to solve the problem. You can always use mysql to check whether your sql statements are running. 1. Display a list of the forms of government in the whole world.

2. Retrieve a list of languages in Asia. Use the IN operator.3. Using INNER JOIN, retrieve a list of districts and corresponding cities for countries in Africa. 4. Compute for the total population from the different cities in the Philippines. Assume that you dont know the country code of the Philippines. 5. Compute for the total population from the different cities in the countries in Europe and display the list in descending order (based on the population).Hint: use alias.6. Using subqueries, display all the cities in the country Antarctica. Assume that you dont know the country code of Antarctica.7. Display the languages spoken in Philippines. Assume that you dont know the country code of the Philippines.8. Display the number of countries in each continent.9. Retrieve a list of district names in Japan. Assume that you dont know the country code of Japan.10. Display the official language of the Philippines. Assume that you dont know the country code of the Philippines.