Introduction to Relational Databases Challenge 2.4 (WGU)
All invoices from USA will require a fee paid to an external organization for 10% of the total. Which of the following statements would query the sum of the total of the invoices in the country USA and calculate 10% of it? a.) SELECT AVG(total*.10) AS calculated_fee FROM invoice WHERE billing_country = 'USA'; b.) SELECT total(SUM)*.10 AS calculated_fee FROM invoice WHERE billing_country = 'USA'; c.) SELECT SUM(total)*.10 AS calculated_fee FROM invoice WHERE billing_country = 'USA'; d.) SELECT SUM(total)*.90 AS calculated_fee FROM invoice WHERE billing_country = 'USA'; The organization would like to see how much money they would make if they increased the total by 20% for those who live in Canada. Which of the following statements would query the sum of the total of the invoices increased by 20% for those who live in Canada? a.) SELECT total*1.20 AS possible_total FROM invoice WHERE billing_country = 'Canada'; b.) SELECT SUM(total)*.20 AS possible_total FROM invoice WHERE billing_country = 'Canada'; c.) SELECT SUM(total)*1.20 AS possible_total FROM invoice WHERE billing_country = 'Canada'; d.) SELECT SUM(total)*.8 AS possible_total FROM invoice WHERE billing_country = 'Canada'; Which of the following statements would query the invoice_line table to sum up the totals by multiplying the unit_price by the quantity grouped by invoice_id? a.) SELECT invoice_id, SUM(quantity * unit_price) AS total FROM invoice_line ORDER BY total DESC; b.) SELECT invoice_id, quantity * unit_price AS total FROM invoice_line GROUP BY invoice_id ORDER BY total DESC; c.) SELECT invoice_id, SUM(quantity * unit_price) AS total FROM invoice_line GROUP BY invoice_id ORDER BY total DESC; d.) SELECT invoice_id, SUM(quantity + unit_price) AS total FROM invoice_line GROUP BY invoice_id ORDER BY total DESC; Which of the following is the valid syntax for creating a VIEW to view a subset of a table? a.) CREATE VIEW mississippi_customers SELECT * FROM customer WHERE state = 'MS'; b.) CREATE VIEW mississippi_customers AS customer WHERE state = 'MS'; c.) CREATE VIEW mississippi_customers AS customer SELECT *
Document information
- Uploaded on
- November 8, 2023
- Number of pages
- 14
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers