Write select statement to create the inner join of tables sec1310_table1 and sec1310_table2 . The join condition
Question:
Write select statement to create the inner join of tables sec1310_table1 and sec1310_table2. The join condition should say that the first three columns of these tables are equal.
Write select statement to list all the foods on the lunch menu and show the full name of the supplier of each food.
MY CODE: (not working)
SELECT a.description, b.supplier_name FROM L_Foods AS a JOIN L_Suppliers AS b ORDER BY a.description;
Demonstrate that a select statement can be separated into two parts: The first part joins the tables and creates a new table, and the second part restricts the amount of data that is shown. For the following select statement, write two SQL statements to separate these two steps.
select a.description,
b.supplier_name
from L_FOODS a,
L_SUPPLIERS b
where a.supplier_id = b.supplier_id
order by a.description;
MY CODE: (not working)
SELECT a.description, b.supplier_name FROM L_Foods AS a JOIN L_Suppliers AS b;
SELECT a.description, b.supplier_name FROM L_Foods AS a JOIN L_Suppliers AS b; WHERE a.supplier_id = b.supplier_id ORDER BY a.description;
List all the foods on the menu and the total number of orders for each food item. (Note that broccoli does not show up in the result because no one has ordered it.)
MY CODE: (not working)
SELECT a.description, SUM(c.total_orders) AS "Total Number of Orders" FROM L_Foods AS a JOIN L_Orders AS c WHERE
Join all the tables of the lunches database together (Anything table starting with L_). Show all the columns of each table. To get , modify the select statement in this section and add the three other tables to it. How many rows and columns are in this table?
MY CODE: (not working)
SELECT * FROM L_Lunches AS d INNER JOIN L_Foods AS a INNER JOIN L_Suppliers AS b INNER JOIN L_Orders AS c;
Financial Management Theory and Practice
ISBN: 978-0176517304
2nd Canadian edition
Authors: Eugene Brigham, Michael Ehrhardt, Jerome Gessaroli, Richard Nason