Question

The goal is to write several SQL queries that will answer questions over the database used...

The goal is to write several SQL queries that will answer questions over the database used by the imaginary Sierra Peak Climbing Club (SPCC), an organization whose members climb the mountain peaks of California’s Sierra Nevada mountain range.

The database maintained by the SPCC has four tables:

PEAK (NAME, ELEV, DIFF, MAP, REGION)

CLIMBER (NAME, SEX)

PARTICIPATED (TRIP_ID, NAME)

CLIMBED (TRIP_ID, PEAK, WHEN_CLIMBED)

The database tables have the following semantics:

• PEAK gives information about the mountain peaks that the SPCC is interested in. This table lists the name of each peak, its elevation, its difficulty level for climbers (on a scale of 1 to 5), the map that it is located on, and the region of the Sierra Nevada that it is located in.

• CLIMBER lists the SPCC membership, and gives their name and gender.

• PARTICPATED gives the set of climbers who participated in each of the various SPCC-sponsored climbing trips. The number of participants in each trip varies.

• CLIMBED tells which peaks were climbed on each of the SPCC-sponsored climbing trips, along with the date that each peak was climbed.

Write SQL queries that answer the following question.

1. Compute the average number of peaks scaled by the men in the club and by the women in the club.

The easiest way to get started with this assignment is to use an online SQLite tool. For example, https://sqliteonline.com/. In this tool, you can load the database and perform your queries.

Here is the data base file to upload to the website

https://files.fm/u/pbfqg3rd

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi,

This can be solved by firstly calculating the count of number of trips for both men and women and then taking the average of that value.

SELECT AVG(CNT) FROM(
SELECT SELECT SEX,COUNT(*) AS CNT FROM CLIMBER C
INNER JOIN PARTICIPATED P
ON C.NAME=P.NAME
INNER JOIN CLIMBED CL
ON P.TRIP_ID=CL.TRIP_ID
GROUP BY SEX);

Add a comment
Know the answer?
Add Answer to:
The goal is to write several SQL queries that will answer questions over the database used...
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
  • The goal is to write several SQL queries that will answer questions over the database used...

    The goal is to write several SQL queries that will answer questions over the database used by the imaginary Sierra Peak Climbing Club (SPCC), an organization whose members climb the mountain peaks of California’s Sierra Nevada mountain range. The database maintained by the SPCC has four tables: PEAK (NAME, ELEV, DIFF, MAP, REGION) CLIMBER (NAME, SEX) PARTICIPATED (TRIP_ID, NAME) CLIMBED (TRIP_ID, PEAK, WHEN_CLIMBED) The database tables have the following semantics: • PEAK gives information about the mountain peaks that the...

  • You will need to refer to the University database to answer this question. Write SQL queries...

    You will need to refer to the University database to answer this question. Write SQL queries to perform the following operations. each case show the SQL statement you used and the output from MySQL. You are required to include screenshots showing the actu output of your queries. The tables of University database are as follows: region (region_number, address, telephone, email _address) staff (staff number, name, address, email_address, telephone,

  • Using the database: Write SQL queries for each of the questions below. 1. Find the media...

    Using the database: Write SQL queries for each of the questions below. 1. Find the media type which has 100 or more tracks. Print the name of such media type. Number of rows returned in the result = 3 A) Find the playlists which have one or more tracks that have never been purchased in California (CA). Print the Id, and the name of such playlists. Number of rows returned in the result = 18 B) Find the customers who...

  • Given the following relational schema, write queries in SQL to answer the English questions. The Access...

    Given the following relational schema, write queries in SQL to answer the English questions. The Access Database for the schema is available, as is a DDL file. It is also available on the MySQL server. You must only submit the SQL for your answers. You can get your answers without using a DBMS or by using Access or MySQL. Customer(cid: integer, cname: string, address: string, city: string, state: string) Product(pid: integer, pname: string, price: currency, inventory: integer) Shipment(sid: integer, cid:...

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
ADVERTISEMENT