Column called orderdate date not null and add

Info icon This preview shows pages 2–4. Sign up to view the full content.

column called OrderDate DATE NOT NULL, and ADD AUTO_INCREMENT to OrderID [see example below for how to do that] (Keep in mind you CAN use multiple ADDS as long as they are separated by a comma) For example: ALTER TABLE MyTable ADD test1 INT NOT NULL, ADD test2 INT NOT NULL; ALTER TABLE Orders CHANGE OrderID OrderID INT NOT NULL AUTO_INCREMENT; Paste the SQL query to make the changes here: CREATE TABLE `orders` ( `OrderID` int(11) NOT NULL AUTO_INCREMENT, `OrderDate` date NOT NULL, PRIMARY KEY (`OrderID`) ) Next, create the OrderDetails table as shown below: Orders OrderID INT NOT NULL OrderDetails PK,F K OrderID INT NOT NULL PK,F K ProductID INT NOT NULL
Image of page 2

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Paste the SQL query needed for the OrderDetails table here: CREATE TABLE `orderdetails` ( `OrderID` int(11) NOT NULL, `ProductID` int(11) NOT NULL, PRIMARY KEY (`OrderID`,`ProductID`), KEY `ProductID` (`ProductID`), CONSTRAINT `orderdetails_ibfk_2` FOREIGN KEY (`ProductID`) REFERENCES `products` (`ProductID`), CONSTRAINT `orderdetails_ibfk_1` FOREIGN KEY (`OrderID`) REFERENCES `orders` (`OrderID`) Step 3: Using the Structure tab, click on any of the tables you just created. What size integer does MySQL use as the default if no size is given (i.e. using INT instead of INT(2))? Step 4: Insert the following data into Products using the SQL tab (NOTE: Please the SQL insert commands below) ProductID Description Price 1 MacBook Pro 1,200.00 2 Apple Display 999.00 3 Headphones 75.50 4 Mouse 27.98
Image of page 3
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '08
  • MCCONN,CHARLOTTERYOO,JUNGWOO
  • Insert Statements, OrderID, OrderDetails, C. SQL tab, MySQL use

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern