Question: What each query is requesting from the database. Include descriptions for what ALL of the following SQL keywords are doing in each query they are

What each query is requesting from the database.

Include descriptions for what ALL of the following SQL keywords are doing in each query they are present in: SELECT, FROM, WHERE, and ORDER BY

Include a description of how the tables are being unioned together.

QUERY 1

SELECT `Active` AS source, invoice_number, invoice_date, invoice_total

FROM paid_invoices

WHERE invoice_date >= `2014-06-01

UNION

SELECT `Paid AS source, invoice_number, invoice_date, invoice_total

FROM paid_invoices

WHERE invoice_date >= `2014-06-01

ORDER BY invoice_total DESC

QUERY 2

SELECT `Active` AS source, invoice_number, invoice_date, invoice_total

FROM paid_invoices

WHERE invoice_total payment_total credit_total > 0

UNION

SELECT Paid AS source, invoice_number, invoice_date, invoice_total

FROM invoices

WHERE invoice_total payment_total credit_total <= 0

ORDER BY invoice_total DESC

QUERY 3

Select invoice_number, vendor_name, 33% Payment AS payment_type, invoice_total AS total, invoice_total * 0.333 AS payment

FROM invoivces JOIN vendors

ON invoices.vendor_id = vendors.vendor_id

WHERE invoice_total > 10000

UNION

Select invoice_number, vendor_name, 50% Payment AS payment_type, invoice_total AS total, invoice_total * 0.5 AS payment

FROM invoivces JOIN vendors

ON invoices.vendor_id = vendors.vendor_id

WHERE invoice_total BETWEEN 500 AND 10000

UNION

Select invoice_number, vendor_name, Full Payment AS payment_type, invoice_total AS total, invoice_total AS payment

FROM invoivces JOIN vendors

ON invoices.vendor_id = vendors.vendor_id

WHERE invoice_total < 500

ORDER BY payment_type, vendor_name, invoice_number

What each query is requesting from the database.

Include descriptions for what ALL of the following SQL keywords are doing in each query they are present in: SELECT, FROM, WHERE, and ORDER BY

Include a description of how the tables are being unioned together.

QUERY 1

SELECT `Active` AS source, invoice_number, invoice_date, invoice_total

FROM paid_invoices

WHERE invoice_date >= `2014-06-01

UNION

SELECT `Paid AS source, invoice_number, invoice_date, invoice_total

FROM paid_invoices

WHERE invoice_date >= `2014-06-01

ORDER BY invoice_total DESC

QUERY 2

SELECT `Active` AS source, invoice_number, invoice_date, invoice_total

FROM paid_invoices

WHERE invoice_total payment_total credit_total > 0

UNION

SELECT Paid AS source, invoice_number, invoice_date, invoice_total

FROM invoices

WHERE invoice_total payment_total credit_total <= 0

ORDER BY invoice_total DESC

QUERY 3

Select invoice_number, vendor_name, 33% Payment AS payment_type, invoice_total AS total, invoice_total * 0.333 AS payment

FROM invoivces JOIN vendors

ON invoices.vendor_id = vendors.vendor_id

WHERE invoice_total > 10000

UNION

Select invoice_number, vendor_name, 50% Payment AS payment_type, invoice_total AS total, invoice_total * 0.5 AS payment

FROM invoivces JOIN vendors

ON invoices.vendor_id = vendors.vendor_id

WHERE invoice_total BETWEEN 500 AND 10000

UNION

Select invoice_number, vendor_name, Full Payment AS payment_type, invoice_total AS total, invoice_total AS payment

FROM invoivces JOIN vendors

ON invoices.vendor_id = vendors.vendor_id

WHERE invoice_total < 500

ORDER BY payment_type, vendor_name, invoice_number

What each query is requesting from the database.

Include descriptions for what ALL of the following SQL keywords are doing in each query they are present in: SELECT, FROM, WHERE, and ORDER BY

Include a description of how the tables are being unioned together.

QUERY 1

SELECT `Active` AS source, invoice_number, invoice_date, invoice_total

FROM paid_invoices

WHERE invoice_date >= `2014-06-01

UNION

SELECT `Paid AS source, invoice_number, invoice_date, invoice_total

FROM paid_invoices

WHERE invoice_date >= `2014-06-01

ORDER BY invoice_total DESC

QUERY 2

SELECT `Active` AS source, invoice_number, invoice_date, invoice_total

FROM paid_invoices

WHERE invoice_total payment_total credit_total > 0

UNION

SELECT Paid AS source, invoice_number, invoice_date, invoice_total

FROM invoices

WHERE invoice_total payment_total credit_total <= 0

ORDER BY invoice_total DESC

QUERY 3

Select invoice_number, vendor_name, 33% Payment AS payment_type, invoice_total AS total, invoice_total * 0.333 AS payment

FROM invoivces JOIN vendors

ON invoices.vendor_id = vendors.vendor_id

WHERE invoice_total > 10000

UNION

Select invoice_number, vendor_name, 50% Payment AS payment_type, invoice_total AS total, invoice_total * 0.5 AS payment

FROM invoivces JOIN vendors

ON invoices.vendor_id = vendors.vendor_id

WHERE invoice_total BETWEEN 500 AND 10000

UNION

Select invoice_number, vendor_name, Full Payment AS payment_type, invoice_total AS total, invoice_total AS payment

FROM invoivces JOIN vendors

ON invoices.vendor_id = vendors.vendor_id

WHERE invoice_total < 500

ORDER BY payment_type, vendor_name, invoice_number

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!