Answered step by step
Verified Expert Solution
Question
1 Approved Answer
here are rhe six inquiry queries the six examples queries the following questions need to be answered: what is each query requesting from the database
here are rhe six inquiry queries
the six examples queries the following questions need to be answered:
Chapter 4 How to retrieve data from two or The syntax for an inner join that uses table aliases SELECT select_list FROM table_1 al 5 [INNER) JOIN tabl. 2 ON a1.column name operator a2.column_name [[INNER) JOIN table_3 a3 ON a 2.column_name operator a3.column_name)... Aliases for all tables 10139 SELECT invoice number, vendor name, invoice_due date: invoice total - payment total - credit total As balance_due FROM vendors v JOIN invoices i ON v.vendor_id = i.vendor_id WHERE invoice total - payment total - credit total > 0 ORDER BY invoice_due date DESC invoice Jumber vendor some invoice due date balance due 547480102 Blue Cross 2014-08-31 224.00 0-2436 Maloy Lithographing Inc 2014-08-30 10976.06 9982771 Ford Motor Credit Company 2014-08-23 503.20 P-0608 Maloy Lithographing Inc 2014-08-22 19351.18 ottobre (11 rows) rombloop o b ob An alias for only one table SELECT invoice_number, line_item_amount, line_item_description FROM invoices JOIN invoice_line_items line_items ON invoices.invoice_id - line_items.invoice_id WHERE account_number = 540 ORDER BY invoice_date invoice_number ine_item_amount ine_item_description 177271-001 4 78.00 Publishers Marketing 972110 207.78 Prospect list 133560 175.00 Card deck advertising 97/522 765.13 Catalog design (6 rows) Description A table alias is an alternative table name assigned in the FROM clause. Yo an alias, which is typically just a letter or two, to make a SQL statement es Chapter 4 How to retrieve data from two or The syntax for an inner join that uses table aliases SELECT select_list FROM table_1 al 5 [INNER) JOIN tabl. 2 ON a1.column name operator a2.column_name [[INNER) JOIN table_3 a3 ON a 2.column_name operator a3.column_name)... Aliases for all tables 10139 SELECT invoice number, vendor name, invoice_due date: invoice total - payment total - credit total As balance_due FROM vendors v JOIN invoices i ON v.vendor_id = i.vendor_id WHERE invoice total - payment total - credit total > 0 ORDER BY invoice_due date DESC invoice Jumber vendor some invoice due date balance due 547480102 Blue Cross 2014-08-31 224.00 0-2436 Maloy Lithographing Inc 2014-08-30 10976.06 9982771 Ford Motor Credit Company 2014-08-23 503.20 P-0608 Maloy Lithographing Inc 2014-08-22 19351.18 ottobre (11 rows) rombloop o b ob An alias for only one table SELECT invoice_number, line_item_amount, line_item_description FROM invoices JOIN invoice_line_items line_items ON invoices.invoice_id - line_items.invoice_id WHERE account_number = 540 ORDER BY invoice_date invoice_number ine_item_amount ine_item_description 177271-001 4 78.00 Publishers Marketing 972110 207.78 Prospect list 133560 175.00 Card deck advertising 97/522 765.13 Catalog design (6 rows) Description A table alias is an alternative table name assigned in the FROM clause. Yo an alias, which is typically just a letter or two, to make a SQL statement es Chapter 4 How to retrieve data from two or m e syntax of a table name that's qualified with a database name database_name.table_name CA in to a table in another database SELECT vendor name, customer last name, customer_first_name, vendor_state as state, vendor_city As city FROM vendors v JOIN om.customers c ON v.vendor_zip_code = c.customer_zip ORDER BY state, city vendor_name customer_last name customer_first_name state city Wels Fargo Bank Marissa Kyle AZ Phoenix Aztek Label Irvin Ania Anaheim Neftaly Digital Dreamworks Thala Fresno CA Dataforms/West Neftaly Thala Fresno Gostanian General Building Neftaly Thala Fresno Gary McKeighan Insurance Holbrooke Rashad Fresno Holbrooke Zyka Design Rashad Fresno Holbrooke Costco Rashad Fresno Digital Dreamworks Holbrooke Fresno Rashad Holbrooke Dataforms/West Rashad Fresno CA Lou Gentle's Flower Basket Deborah Fresno Damien CA Neftaly CA Thala Wakefield Co Fresno 33333 (37 rows) scription A MySQL server can store tables in multiple databases. These databases are al Chapter 4 How to retrieve data from two or more to 'he Customers table customer_id customer customer state N Maria customer last name Anders Trullo Moreno Hardy Berglund Moos customer address 345 Winchel 1298 E Sathers St 6925 N Parland Ave 83 d'Urbervilein 22717 E 73rd Ave 1779 N Bovine Ave Ana Antonio Thomas Christine Hanna customer_oty Anderson Benton Puyallup Casterbridge Dubuque Peoria WA custom 16014 72018 98373 31209 5.2004 61638 GA TA (24 rows) manager_id - Dod 'he Employees table employee_id last_name first name department_number Smith Cndy Jones Simonian Ralph Hernandez Olva Aaronsen Robert Watson Denise (9 rows) tolong an inner join with two conditions SELECT customer_first_name, customer_last_name FROM customers c JOIN employees e ON c.customer_first_name = e. first_name AND c.customer last name = e. last name customer_first_name customer Jost_name (1 row) escription A join condition can include two or more conditions connected by AND or OR Chapter 4 How to retrieve data from two or more tables A self-join that returns vendors from cities in common with other vendors SELECT DISTINCT V1.vendor name, vl.vendor_city, v1.vendor_state FROM vendors vi JOIN vendors v2 ON v1.vendor_city = v2.vendor_city AND vi.vendor state v2.vendor state AND vi.vendor_name v2.vendor name ORDER BY vi.vendor_state, vi.vendor_city vendor me vendor aty vendor state Wells Fargo Bank Phoenix Computer Library Phoenix Phoenix Aztek Label Anaheim Blue Shield of California Anaheim Coffee Break Service Crown Printing Wakefield Co AZ (84 rows) Description A self-join is a join that joins a table with itself. When you code a self-join, you must use aliases for the tables, and you must qualify each column name with the alias. Chapter 4 How to retrieve data from two or more tables A statement that joins four tables SELECT vendor_name, invoice number, invoice_date, line_item_amount, account_description FROM vendors v JOIN invoices i V. vendor_id = 1. vendor_id JOIN invoice_line_items li ON i.invoice_id = li.invoice_id JOIN general_ledger_accounts gl ON li.account number = gl.account number WHERE invoice total - payment total - credit total > 0 ORDER BY vendor_name, line_item amount DESC O vendor name invoice number mase date Ine item amount account description Blue Cross 547480102 2014-08-01 224.00 Group Insurance Cardinal Business Media, Inc. 134116 2014-07-23 90.36 Direct Mail Adrertising Data Reproductions Corp 39104 2014-07-10 85.31 Book Printing Costs Federal Express Corporation 263253270 2014-07-22 67.92 Freight Federal Express Corporation 263253268 2014-07-21 59.97 Freight Federal Express Corporation 963253254 2014-07-18 52.25 Freight Federal Express Corporation 263253273 2014-07-22 30.75 Freight Ford Motor Credit Company 9982771 2014-07-24 503.20 Travel and Accomodations - (11 rows) Description You can think of a multi-table join as a series of two-table joins proceeding from left to right + CS576_Week 2 Assignment2.2 View Zotero Review References Mailings previous B a ERE Tracking Reviewing Changes Next te Language New Delete Resolve Comment 76_Week2_Assignment2.2 this assignment, be sure to use your playground database to test the es you write. 1-6.) Type each of the 6 example queries from the book on the right-hand pages of pages 114-123. Test them in playground. And then, for each, Explain in your own English words: 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, DISTINCT, FROM, WHERE, and ORDER BY SELECT: Joins data from the vendor and invoice tables DISTINCT: Specifies FROM: which source the information is drawn from WHERE: Where to look for the information ORDER BY: Specifies how data should be arranged. Include a description of how the two tables are being joined together. Each table being joined that has the same value. Both tables must have the same invoice number and amount in order for them to be joined. PA SAHA O 29 w MacBook Pro what is each query requesting from the database
give a description of the following SQL keywords are doing in the query; SELECT, DISTINC. FROM, WHERE, and ORDER BY,
Include a description of how the two tables are being joined togerher.
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