Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE `mockup_new_order` ()
- BEGIN
- select
- -- order id
- odp.ProductID
- ,p.UnitPrice
- ,1 as `Quantity`
- ,0 as `Discount`
- from order_data_processing odp
- left join product p on odp.ProductID = p.ProductID
- into orders;
- select
- -- autoincrement OrderID,
- odp.CustomerID,
- 1 as EmployeeID,
- curdate() as OrderDate,
- NULL as RequiredDate,
- NULL as ShippedDate,
- 1 as ShipVia,
- 1 as Freight,
- c.CompanyName as ShipName,
- c.Address as ShipAddress,
- c.City as ShipCity,
- c.Region as ShipRegion,
- NULL as ShipPostalCode
- from order_data_processing odp
- left join customers c on odp.CustomerID = c.CustomerID
- into order_details;
- delete
- from order_data_processing;
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement