Sei sulla pagina 1di 3

Tendencias I IIN-0400 Segundo Semestre 2018-2019 Deber #9 – SQL y Consultas en SAS Studio

El objetivo del deber es que los estudiantes se familiaricen con la herramienta de SAS Studio para la creación de bases de datos, pero sobre todo el realizar consultas (queries) para extraer los datos necesarios y contestar preguntas del negocio.

Instrucciones:

- Ir al folder del curso en SAS Studio y buscar el folder de Pack_N_Ship:

- my_courses > csuarez2 > MiSQL > Pack_N_Ship > Setup

- Aquí existen 2 archivos Codigo-HW-PNS_Setup_Parte1.sas (parte1 y parte2).

- Crear los folders necesario dentro de su usuario de SAS para que puedan crear los

archivos dentro de su usuario y puedan manipular el código.

- Crear 2 archivos (para parte1 y parte2) y copiar el código respectivo en esos nuevos archivo en sus carpetas locales, cambiar el nombre de usuario según se indica y ejecutar el código correspondiente para crear la base de datos necesaria.

- Crear un 3er archivo donde ingresen el código SQL para realizar los queries correspondientes y poder contestar las preguntas indicadas. El nombre debe seguir el siguiente formato:

- [InicialNombre1_Apellido1_InicialNombre2_Apellido2]_Deber10.sas

La situación de la empresa Pack-N-Ship es la siguiente:

Pack-N-Ship is a convenience based parcel assistance company. Pack-N-Ship’s primary service offering is to pick up and drop off packages on a timely basis. Pack-N-Ship does this directly to a customer's exact location. Pack-N-Ship first picks up items to be shipped from a customer's door/office/anywhere, packs the items into boxes and drops them off at a local hub. From this hub, Pack-N-Ship has a partner company that takes each package to a transshipment point and then finally to a drop off hub near the package's final destination. A Pack-N-Ship driver in that city then, picks up the package and delivers it to the package's final destination at a specified time.

Pack-N-Ship drivers are independent and operate on their own schedules. Similar to Uber and Lyft, Pack-N-Ship drivers are paid for each package they deliver or pick up. Allocation of drivers is done in real time by offering payments to drivers for their services and routing drivers around to customers and local pickup points accordingly.

You are looking to help Pack-N-Ship answer a few business questions through queries.

There is a Shipments table that includes:

Shipment_ID (Integer) (Primary Key)

Shipment_Order_Date (Integer) (In terms of days since Jan 1, 2016)

Shipment_Delivery_Date (Integer) (In terms of days since Jan 1, 2016)

Shipment_Size (Decimal) (In cubic feet)

Shipment_Weight (Decimal) (In pounds)

Origin_Location_ID (Integer) (Foreign Key) (References to Locations.Location_ID)

Destination_Location_ID (Integer) (Foreign Key) (References to Locations.Location_ID)

Shipment_Cost (Decimal) (In USD)

Transshipment_Point_ID (Integer) (Foreign Key) (References to TSPs.Transshipment_Point_ID)

Customer_ID (Integer) (Foreign Key) (References to Customers.Customer_ID)

There is a Locations table for all hubs that includes:

Location_ID (Integer) (Primary Key)

Location_City (Text)

Location_State (Text)

There is a TSPs (Trans-shipment points) table that includes:

Transshipment_Point_ID (Integer) (Primary Key)

Transshipment_Point_Location_ID (Integer) (Foreign Key) (References to Locations.Location_ID)

There is a Customers table for all hubs that includes:

Customer_ID (Integer) (Primary Key)

Customer_Name (Text)

Customer_Type (Text)

The Pack-N-Ship partner company has multiple transshipment points located in various places around the United States. These are placed in the TSPs table and are used to verify the Transshipment_Point_ID in the Shipments table. At the same time, the Transshipment_Point_Location_ID is verified in the Locations Table. While this happens external to the company, Pack-N-Ship has found it important to monitor this to keep customers updated on any particular shipment's progress.

The senior supply chain team members at Pack-N-Ship have heard about your skills with SQL and all have requests for you.

Q1: Christopher Patterson, the deputy director of supply chain at Pack-N-Ship, wants to find out which hub locations exist in the state of Indiana. (Note that 'hub locations' are different from 'transshipment locations').

Q2: Amanda Price, the executive vice president of supply chain at Pack-N-Ship, wants to know which shipment_ID had the second highest individual Shipment_Cost?

Q3: Alan Young, the associate director of supply chain at Pack-N-Ship, wants to determine what is the total cost of all shipments in the database that had a shipment destination in Fort_Worth (Location_City)?

Q4: Carmen Sanders, the VP of supply chain at Pack-N-Ship, wants to find out which Shipment Origin City has a total shipment cost (sum of all shipments out) of $1723.46 to date (rounded to two decimal places)?

Q5: Sandra Cox, the president of supply chain at Pack-N-Ship, wants to find out which Customer (by Name) shipped a total weight of 11148.21 pounds to date (rounded to two decimal places)?

Q6: Gene Paremesean, Senior Warehouse Operations Manager, wants to know: What is the average weight of a Pack-N-Ship shipment?

Q7: With great excitement, Gene Paremesean, Senior Warehouse Operations Manager, follows up. What is the average weight of a Pack-N-Ship shipment that goes through Chicago as a transhipment point?

Entregables

- Subir el archivo de SAS que incluya los queries realizados para contestar las preguntas.

- Subir un PDF donde esté el código de los queries (solo los queries) y las respuestas a las preguntas tanto escritas por ustedes, como un screenshot del resultado de ejecutar el comando SQL en SAS.

El deber es en parejas.

Fecha de entrega: Domingo 5 de mayo 2019 en el D2L.