Question: Write the following SQL statements to query the NDX table in the dbclass schema/database. Your SQL statement should display only the columns identified unless otherwise

Write the following SQL statements to query the NDX table in the dbclass schema/database. Your SQL statement should display only the columns identified unless otherwise specified.

1. Display the ChangeClose on the day Wednesday.

2. Display the average ChangeClose grouped by TMonth, TYear. Show the TYear, TMonth, and the average ChangeClose in that grouping.

Subqueries and Outer Joins

shipper

Column

Data Type

Description

shipper_id

int

primary key

shipper_name

varchar

name

shipment

Column

Data Type

Description

shipper_id

int

foreign key (exported from shipper table)

source

varchar

destination

varchar

completed

char

3. Write a SQL subquery which determines which records in the shipper table have no related records in the shipment table.

4. Write a SQL subquery which determines which records in the shipment table have no related records in the shipper table.

5. Write an outer join which joins the shipper table to the shipment table. This select statement should retrieve shipper table records whether or not they have corresponding records in the shipment table.

OPTIONAL EXTRA CREDIT

Use a correlated subquery between the shipper table and the shipment table to determine which shippers have not made any shipments. The correlated subquery must use and EXISTS clause.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!