T
Tina
I am really struggling with my database class. I'm taking it online which
was a HUGE mistake & just don't understand the lessons. I need some more
help with an assignment.
1) I need to insert 2 rows into a table I created. I don't know if there's
a way to combine them, so I did 2 separate ones -- the 1st one added, but the
2nd didn't. Does anyone see something that I'm not seeing???
INSERT INTO [Order Details] (OrderID,ProductID,UnitPrice,Quantity,Discount)
VALUES (12000,56,30.35,5,0);
INSERT INTO [Order Details] (OrderID,ProductID,UnitPrice,Quantity,Discount)
VALUES (12000,77,10.25,3,5); THIS WON’T ADD
2) I had to select Customers with no orders. The following worked:
SELECT Customers.CustomerID, Customers.CompanyName
FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID
WHERE ((Orders.CustomerID) Is Null);
Next, I need to delete these particular customers. I tried the following &
got "could not delete from specified tables":
DELETE Customers.*
FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID
WHERE ((Orders.CustomerID) Is Null);
3) I created a table called BigOrders and need to insert rows from Orders &
OrderDetails where the Totals are > $10,000. (Totals is UnitPrice *
Quantity). I don't know how to write a statement to insert rows from 2
separate tables AND with this Totals over >$10,000.
4) I need to add a Column called "Allocated" (sml integer) and set all
values to zero. I did the 2 below statements separately - they worked, but
should I be able to do this in 1 combined statement??
ALTER TABLE Products
ADD Allocated SMALLINT;
UPDATE Products SET Allocated = 0;
5) And lastly, the final question that makes me want to drop this class is
updating all area codes from 206 to 209 where state = Washington. Area code
is part of the whole phone #, ex. (206) 555-1234. I know this has to do with
MID, LEN, etc.. but I just can't seem to get this down.
Any help is appreciated. I have spent so much time on this & am not getting
anywhere.
Thanks in advance.
was a HUGE mistake & just don't understand the lessons. I need some more
help with an assignment.
1) I need to insert 2 rows into a table I created. I don't know if there's
a way to combine them, so I did 2 separate ones -- the 1st one added, but the
2nd didn't. Does anyone see something that I'm not seeing???
INSERT INTO [Order Details] (OrderID,ProductID,UnitPrice,Quantity,Discount)
VALUES (12000,56,30.35,5,0);
INSERT INTO [Order Details] (OrderID,ProductID,UnitPrice,Quantity,Discount)
VALUES (12000,77,10.25,3,5); THIS WON’T ADD
2) I had to select Customers with no orders. The following worked:
SELECT Customers.CustomerID, Customers.CompanyName
FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID
WHERE ((Orders.CustomerID) Is Null);
Next, I need to delete these particular customers. I tried the following &
got "could not delete from specified tables":
DELETE Customers.*
FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID
WHERE ((Orders.CustomerID) Is Null);
3) I created a table called BigOrders and need to insert rows from Orders &
OrderDetails where the Totals are > $10,000. (Totals is UnitPrice *
Quantity). I don't know how to write a statement to insert rows from 2
separate tables AND with this Totals over >$10,000.
4) I need to add a Column called "Allocated" (sml integer) and set all
values to zero. I did the 2 below statements separately - they worked, but
should I be able to do this in 1 combined statement??
ALTER TABLE Products
ADD Allocated SMALLINT;
UPDATE Products SET Allocated = 0;
5) And lastly, the final question that makes me want to drop this class is
updating all area codes from 206 to 209 where state = Washington. Area code
is part of the whole phone #, ex. (206) 555-1234. I know this has to do with
MID, LEN, etc.. but I just can't seem to get this down.
Any help is appreciated. I have spent so much time on this & am not getting
anywhere.
Thanks in advance.