Review of SQL Joins S02 L05

Total Page:16

File Type:pdf, Size:1020Kb

Review of SQL Joins S02 L05

CIS 9003 – Oracle Database Programming PL/SQL LAB A3: Appendix A NAME: ______

Review of SQL Joins: Download this document to your storage media, save this file using the filename: your_name_CIS9003_LabA3.doc Insert your answers into this document. Submit the assignment via email as an attachment to [email protected]

The following questions utilize the World Facts Schema;

Review of SQL Joins Using the World Facts Schema, write the SQL code to accomplish the following tasks; COMPLETE ALL PROBLEMS

1. Write and test an equijoin statement that lists each country’s name, currency code, and currency name. Order the list by country name.

WRITE THE CODE, INPUT INTO APEX, PRINTSCREEN THE CODE HERE, PRINTSCREEN THE PROGRAM RESULTS HERE

2. Write and test an equijoin statement that lists each language and the country or countries where it is official. SOLUTION: SELECT country_name, language_name FROM wf_countries NATURAL JOIN wf_languages NATURAL JOIN wf_spoken_languages WHERE OFFICIAL = ‘Y’ ORDER BY country_name;

3. Display a list of currencies whose name begins with “R” and the country or countries in which they are used. Include currencies which are not used in any country.

WRITE THE CODE ONLY

4. There are 100 rows in table A and 250 rows in table B. The Cartesian product of A and B would yield this number of rows: BOLD THE CORRECT ANSWER

A. 250 B. 25000 C. 100 D. none of the above

5. Given the tables BEVERAGES and TEMPERATURE_RANGES, write a SQL statement that will display the beverage, temperature, and range as defined by the low and high values.

BEVERAGES Beverage Temperature Coffee 180 Wine 68 Soda 45

TEMPERATURE_RANGES Range Low_Value High_Value Hot 120 212 Room 60 119 Cool 32 59 Very cool 0 31

WRITE THE CODE, INPUT INTO APEX, PRINTSCREEN THE CODE HERE, PRINTSCREEN THE PROGRAM RESULTS HERE

Recommended publications