SELECT ingredient_id, ingredient_name, date_ordered,
CONCAT(quantity, unit) AS "Quantity & Unit"
FROM ingredient ing LEFT OUTER JOIN ingredient_purchase_list ing2
ON ing.ingredient_id = ing2.ingredient_id
ORDER BY ingredient_id;
(It says column ambiguosly defined)
SELECT ingredient_id, ingredient_name, date_ordered,
CONCAT(quantity, unit) AS "Quantity & Unit"
FROM ingredient ing LEFT OUTER JOIN ingredient_purchase_list ing2
ON ing.ingredient_id = ing2.ingredient_id
ORDER BY ingredient_id;
here ingredient_id is present in two tables ingredient and ingredient_purchase_list .so we need to differentiate from which table we are taking ingredient_id.
correct query is
SELECT ing.ingredient_id, ing.ingredient_name, date_ordered,
CONCAT(quantity, unit) AS "Quantity & Unit"
FROM ingredient ing LEFT OUTER JOIN ingredient_purchase_list ing2
ON ing.ingredient_id = ing2.ingredient_id
ORDER BY ing ingredient_id;
List the ingredient id, name, date ordered, quantity & unit (in one column) for all ingredients,...
All ingredients purchased in November. Display the ingredient id, name, date ordered, quantity & unit (in one column), unit price, and total amount for each item. Order the result set by descending date ordered. Hint: total amount is quantity multiplied by unit price. (ORA-00904: "MONTH": invalid identifier) SELECT ingredient_id, ingredient_name, date_ordered, "Quantity & Unit" AS Quantity, unit_price * quantity AS "Total Amount" FROM ingredient WHERE month('date_ordered') = 11 ORDER BY 'date_ordered' DESC;
List of all information about ingredients purchased, sorted by date ordered. Include the ingredient name (Hint: use a join) Dont' get it what's wrong... SELECT ingredient_name, date_ordered, quantity, unit, unit_price FROM ingredient INNER JOIN ingredient_purchase_list ON ingredient_id = ingredient_id ORDER BY date_ordered;
25. The president of the company wants a list of all orders ever taken. He wants to see the customer name, the last name of the employee who took the order, the shipper who shipped the order, the product that was ordered, the quantity that was ordered, and the date on which the order was placed. [Hint: You will need to join the following tables: Customers, Employees, Shippers, Orders, OrderDetails, Products, and to get all of the necessary information.] attempted...
can someone solve these quick
please and thank you!
sql chapter 4
Query #1: List the company name, contact name, contact title and
the phone number for customers who HAVE NOT put in an order. Use an
outer join.
Query #2: Create a listing displaying the employee first name,
last name and the full name (First name space Last Name) of the
person they report to (Supervisor). This is a self-join. If an
employee does not report to anyone then...
I need help with certain questions. Please.
18. 4 points
For each Rental, list the Rental ID,
Rental date, customer ID, customer first name, customer last name,
and count of disks rented; sort by Rental ID. Show the Rental date
formatted as ‘mm-dd-yyyy.’ Hint: use a GROUP BY clause.
19. 4 points
List the disk ID, title name, rating,
format description, and fee amount for all copies rented in Rental
3; sort by disk ID. Show the fee amount formatted...
Create the database and tables
for the database. Show all SQL statements. Include primary and
foreign keys. Insert data into each table. Show select statements
and display the output of each table. Note:Student’s name must be
inserted into table as part of the data! Perform the SQL below:
Query one table and use WHERE to filter the results. The SELECT
clause should have a column list, not an asterisk (*). State the
purpose of the query; show the query and...
1,List the first and last name of the donators that donated in
December 2009.
2. List the ID's of the volunteers that have not worked.
3. List the ID, first name, and last name of any employees who
works in the Finance department.
4. List all the different prices suppliers have for 'Tasty Meat'
product.
5. Select the store ID and store phone number for all stores in
'St.Paul'.
6. List the member first and last name, address, city, zip...
SQL queries and procedures TABLE: Employees Business Rules: EmployeeID is defined as the primary key. Address has been denormalized to include City and State for performance reasons. DeptNbr is a foreign key that references DeptNbr in the Department table Manager is a foreign key that references EmployeeID in the Employees table Data Structure: (EmployeeId, LastName, FirstName, Street, City, State, Zip, DateOfHire, DateOfBirth, JobTitle, Salary, DeptNbr(fk), Manager(fk)) TABLE: Department Business Rules: DeptNbr is defined as the primary key. Data Structure: (DeptNbr,...
use workbench please
Task 1: Create a database and name it practical2DB. (2
marks)
Task 2: Create all the four tables according to the relational
scheme in Figure 1. (8 marks)
Task 3: Insert 5 records to into each table. (5 marks)
Task 4: Write a query to list alphabetically ordered names,
addresses, and IDs of all the customers whose postcode is in
(40150, 40400, 47500).
(10 marks)
Task 5: Delete 1 record from Products table using their primary
keys....