Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question-1 a) For every customer and shipper display the following information: o Type: to denote if it's a customer or a shipper (show: Customer for
Question-1 a) For every customer and shipper display the following information: o Type: to denote if it's a customer or a shipper (show: Customer for customers and Shipper for shippers) Company Name: the company name of the customer or shipper o Number of Orders: the number of orders this customer has placed (or shipper has handled). If there are none, show 0. b) Restrict yourself to customers with 3 or fewer orders and shippers with 50 or fewer orders. c) Sort by company name Your output should be like the following (including column headings): Type Customer Customer Shipper Company Name Number of Orders A Customer 2 Customer A 1 Shipper A 42 Customer Test Customer2 0 Corporation (CORP) Schema Note: the relations are owned by the user "CORP", so all references to the relations would need to be prefixed by "CORP.", E.g.: SELECT * FROM corp.employees; CUSTOMERS Customer names addresses and phone numbers Column Comments CustID Primary Key: Unique five-character code based on customer name CompanyName Company name Contact Name Name of contact person in company Contact Title Role / designation (e.g., salesperson, owner etc.) of the contact person Address City Region State or province Postal Code Country Phone number includes country code or area code Fax Fax number includes country code or area code Phone EMPLOYEES Employee names titles and personal information Column Comments Employee ID Primary Key; Number automatically assigned to new employee Lastname Firstname Title Job title / designation (e.g., Sales representative or Vice President) TitleofCourtesy Title used in salutations (e.g., Mr. / Ms.) Birthdate Hiredate Address Home address City Region Postalcode Country Homephone Phone number includes country code or area code Extension Internal telephone number extension (at work) Reportsto Employee's Supervisor (references a valid employee ID) ORDERS Order information including where it needs to be shipped Column Comments Order ID Primary Key; Number assigned to each order CustID Customer who placed this order (Foreign Key into CUSTOMERS) EmployeeID Employee who is responsible for this order (Foreign Key into EMPLOYEES) Order Date Date order was placed RequiredDate Date the customer needs order by ShippedDate Date we shipped the order ShipVia ID of the shipper we used for this order (Foreign Key into SHIPPERS) Freight Freight charge for the order ShipName Shipping Recipient Name (usually the customer, but not necessarily) ShipAddress Shipping Recipient Address; always a street address (no PO Box) ShipCity City shipped to Shipregion State/Province shipped to ShipPostal Code Postal Code of shipped-to address ShipCountry Country shipped to ORDER DETAILS Details on products, quantities, and prices for each order Column Comments Order ID Primary Key; Also Foreign Key into ORDERS ProductID Primary key; Also Foreign Key into PRODUCTS UnitPrice Selling price of the product (per unit) Quantity Discount Format: decimal rate (e.g., 0.05 implies 5%) PRODUCTS Product names, suppliers, prices, and units in stock Column Comments ProductID Primary Key; Number assigned to each product Product Name Name of the product SupplierID Supplier of the product; Foreign key into SUPPLIERS PL ID Foreign Key into PRODUCT LINES QuantityPerUnit Product unit size (e.g., 24-count case, 1-liter bottle) UnitPrice Current List Price per unit (may differ from price at time of specific order) Units InStock Quantity on hand UnitsOnOrder Units that have been ordered by us but not yet delivered by supplier Reorder Level Minimum units to maintain in stock Discontinued Yes (or I) means item is no longer available PRODUCT LINES Different Product Lines Column PL_ID PL_Name Description Comments Primary Key; Number assigned to each product line Product line name (e.g., Beverages, Condiments) Description of the product line SHIPPERS Shippers Names and phone numbers Column Comments ShipperID Primary Key; Number assigned to each shipper CompanyName Name of shipping company Phone Phone number includes country code or area code SUPPLIERS Supplier names, addresses, phone numbers Column Comments Supplier ID Primary Key: Number assigned to each supplier Companyname Name of supplier Contactname Name of contact person at supplier organization Contacttitle Job title of contact person Address Supplier Street / PO Box address City Region State or province Postalcode Country Phone Phone number includes country code or area code Fax number includes country code or area code Fax
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started