Can someone help me? For 5.13 i am getting this error (1 row(s) affected) (2 row
ID: 3757535 • Letter: C
Question
Can someone help me? For 5.13 i am getting this error
(1 row(s) affected)
(2 row(s) affected)
Msg 208, Level 16, State 1, Line 25
Invalid object name 'Purchasing.Orders'.
Map the ERD into relations
Complete in SQL
Show transcribed image text
Expert Answer
Was this answer helpful?
0
0
2,924 answers
If you have any doubts, please give me comment...
Course(Number, Title);
Class(ClassId, Semester, Year, CourseNumber);
Instructor(InstructorId, Name, OfficeHour);
Building(Code, MapIndex);
Room(Number, MaxSeat, InstructorId, BuldingCode);
Section(SectionID, ClassDate, ClassTime, MaxSeat, NumRegistered, ClassId, InstructorId, RoomNumber);
Student(StudentId, Name, Phone);
Student_Section(StudentId, SectionID, FinalGrade);
Note:
* underline indicates primary key
* italics indicates foreign key
-- 5.4)
SELECT SUM(Quantity*Price) AS 'Total value of Product ID 7 delivered'
FROM Purchasing.Deliveries
WHERE ProductId = 7;
-- 5.7)
SELECT ProductId, Price AS 'Highest priced item'
FROM Purchasing.Deliveries
WHERE Price = (
SELECT MAX(Price)
FROM Purchasing.Deliveries
);
-- 5.13)
SELECT OrderId, SUM(Quantity) AS 'Total units', AVG(Quantity*Price) AS 'Average price'
FROM Purchasing.Orders
GROUP BY OrderId;
-- 5.16)
SELECT SupplierId
FROM Purchasing.Deliveries D, Purchasing.Products P
WHERE P.ProductId = D.ProductId AND DeliveryDate BETWEEN '2016-10-5' AND '2016-10-10';
Relational Database and Transact-SOL Course Classid Semester Title Year FinalGrade Instructor Student Section PK Studentid Sectionld Name Name ClassDate Phone ClassTime MaxSeat NumRegistered Building Room Code PK Number Mapindex MaxSeatExplanation / Answer
The reason you are getting the error is because the expert is trying to query Orders table which, I think, does not exist in your database.'
However, in the screenshots that you have provided here, I cannot possibly deduce how to get the OrderID. None of your tables contains OrderID column and morever, your database does not contain Orders table.
Since I am not able to figure out how to fetch out the orderID, I cannot answer this question right now.
If you can comment if there is some way, I can get the orderID (possibly from a table or by joining multiple tables), I will surely help you out.
For time being, I am providing the answer assuming that you have Orders table.
Query
SELECT OrderID, sum(Quantity) AS 'Total Sales', AVG(Quantity*Price) AS 'Average price' FROM Orders o, Product p WHERE o.ProductId = p.ProductId GROUP BY OrderId ORDER BY Quantity;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.