nss-evening-cohort-11 / WildflowerCoffeeGifts

0 stars 2 forks source link

Update the SQL script with the latest database table changes #35

Open ancasimon opened 3 years ago

ancasimon commented 3 years ago

Recent additions:

  1. Products table > DateCreated field of the DateTime type - nullable.
  2. Products table > new QuantityAvailable field of the type int - nullable.
ancasimon commented 3 years ago

Note about updating the data in our SQL tables : If we need to delete all data in a given table (in order to import updated records from a teammate) > you can get around the foreign key constraints this way:

alter table ProductOrders nocheck constraint all
DELETE FROM Products WHERE Id = 1;
alter table ProductOrders check constraint 

Notes:

  1. ProductOrders in this case / the first table is the one that enforces the constraint (in this case, the productorder record is the parent with a product child / is the record that has the foreign key reference to the product's primary key / id).
  2. Products in this case is the table where we want to delete records from.
ancasimon commented 3 years ago

Beth's query with new products and related data:

USE [WCG]
GO
SET IDENTITY_INSERT [dbo].[CoffeeMugs] ON 
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (1, N'Sports Mug', N'https://images-na.ssl-images-amazon.com/images/I/81Tap3YYnGL._AC_SL1500_.jpg', 1, CAST(10.99 AS Decimal(5, 2)), N'For a lover of all sports!', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (2, N'Travel Mug', N'www.google.com', 2, CAST(10.99 AS Decimal(5, 2)), N'description of travel mug', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (6, N'Star Wars', N'https://images-na.ssl-images-amazon.com/images/I/61xb7R3jucL._AC_SX679_.jpg', 4, CAST(7.50 AS Decimal(5, 2)), N'A classic R2-D2 mug for any Star Wars fan in your life!', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (7, N'Fun-fetti and Ribbon Mug', N'https://sf.tac-cdn.net/images/products/large/TBC01.jpg', 9, CAST(7.50 AS Decimal(5, 2)), N'Use this mug to for any fun event!', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (8, N'Baseball Mug', N'https://epicsports.cachefly.net/images/9634/300/markwort-baseball-sportcups-drinking-mug.jpg', 1, CAST(8.50 AS Decimal(5, 2)), N'A baseball shaped coffee mug', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (9, N'Yellow Smiley Face Mug', N'https://images-na.ssl-images-amazon.com/images/I/21goRIgLqxL._AC_UL600_SR600,600_.jpg', 1, CAST(8.50 AS Decimal(5, 2)), N'The brightest mug we offer!', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (10, N'Gray Coffe Mug', N'https://images-na.ssl-images-amazon.com/images/I/61TOUxzORUL._AC_SL1500_.jpg', 10, CAST(6.50 AS Decimal(5, 2)), N'Just a plain-jane mug', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (11, N'Ask Me About My Cat Mug', N'https://i.ebayimg.com/images/g/TXIAAOSwF0hdRI7x/s-l300.jpg', 4, CAST(7.50 AS Decimal(5, 2)), N'A white mug with black text.', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (12, N'White Coffee Mug', N'https://revol1768-1.images-static.com/11611-large_default/white-mug-round-edges-french-classics.jpg', 10, CAST(5.50 AS Decimal(5, 2)), N'Just a plain mug', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (13, N'Dog Mug', N'https://i.etsystatic.com/14543792/r/il/22c58f/1274192186/il_794xN.1274192186_6ai1.jpg', 3, CAST(10.50 AS Decimal(5, 2)), N'A purple mug with a dog', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (14, N'Pumpkin Mug', N'https://i.etsystatic.com/9486400/r/il/402e94/2184554577/il_1588xN.2184554577_5gv4.jpg', 11, CAST(11.50 AS Decimal(5, 2)), N'A fall themed mug great all all Autumn long!', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (15, N'Darth Vader Mug', N'https://images-na.ssl-images-amazon.com/images/I/71pQM-n7NiL._AC_SL1500_.jpg', 8, CAST(12.50 AS Decimal(5, 2)), N'Another Star Wars mug options!', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (16, N'Anniversary Mug', N'https://slimages.macysassets.com/is/image/MCY/products/2/optimized/9278782_fpx.tif?op_sharpen=1&wid=591&fit=fit,1&$filtersm$&fmt=webp', 6, CAST(8.99 AS Decimal(5, 2)), N'Use this mug as the base for any arrangement you give to that special someone!', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (17, N'Simple Anniversary Mug', N'https://assets.wsimgs.com/wsimgs/ab/images/dp/wcm/202038/0748/img78o.jpg', 6, CAST(8.99 AS Decimal(5, 2)), N'Use this mug as the base for any arrangement you give to that special someone!', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (18, N'Simple White Mug', N'https://splendids.com/images/products/large/11359.jpg', 10, CAST(8.99 AS Decimal(5, 2)), N'A common white mug with a black handle', 1)
GO
INSERT [dbo].[CoffeeMugs] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [IsActive]) VALUES (19, N'Simple Red Mug', N'https://images-na.ssl-images-amazon.com/images/I/5120lqLs-dL._AC_SL1200_.jpg', 10, CAST(8.99 AS Decimal(5, 2)), N'A bright red coffee mug', 1)
GO
SET IDENTITY_INSERT [dbo].[CoffeeMugs] OFF
GO
SET IDENTITY_INSERT [dbo].[FlowerArrangements] ON 
GO
INSERT [dbo].[FlowerArrangements] ([Id], [Title], [ImageUrl], [Price], [Description], [IsActive]) VALUES (1, N'Daisies', N'www.google.com', CAST(19.99 AS Decimal(5, 2)), N'description of bouquet', 1)
GO
INSERT [dbo].[FlowerArrangements] ([Id], [Title], [ImageUrl], [Price], [Description], [IsActive]) VALUES (2, N'Roses', N'www.google.com', CAST(19.99 AS Decimal(5, 2)), N'description of bouquet', 1)
GO
INSERT [dbo].[FlowerArrangements] ([Id], [Title], [ImageUrl], [Price], [Description], [IsActive]) VALUES (3, N'Chrysanthumums', N'www.google.com', CAST(19.99 AS Decimal(5, 2)), N'description of bouquet', 1)
GO
INSERT [dbo].[FlowerArrangements] ([Id], [Title], [ImageUrl], [Price], [Description], [IsActive]) VALUES (4, N'Irises Arrangement', N'https://i.pinimg.com/474x/c9/f8/7b/c9f87b939f2c4d94696b1408aa14fcce.jpg', CAST(9.00 AS Decimal(5, 2)), N'A handful of freshly picked irises', 1)
GO
INSERT [dbo].[FlowerArrangements] ([Id], [Title], [ImageUrl], [Price], [Description], [IsActive]) VALUES (5, N'White Flowers', N'https://cdn.shopify.com/s/files/1/1419/7120/products/Triteleia_Hyacinthina.VP.jpg?v=1571439555', CAST(9.00 AS Decimal(5, 2)), N'A selection of white flowers', 1)
GO
INSERT [dbo].[FlowerArrangements] ([Id], [Title], [ImageUrl], [Price], [Description], [IsActive]) VALUES (6, N'Marigolds', N'https://www.burpee.com/on/demandware.static/-/Sites-BURPEE-Library/default/dwbc98c8cb/Images/Content/CLP%20Flowers/CATID-3460_Marigolds.jpg', CAST(9.00 AS Decimal(5, 2)), N'Orange and Red flowers', 1)
GO
INSERT [dbo].[FlowerArrangements] ([Id], [Title], [ImageUrl], [Price], [Description], [IsActive]) VALUES (7, N'Garden Roses', N'https://64.media.tumblr.com/tumblr_mazauk6dOI1qh1e4vo1_1280.jpg', CAST(9.00 AS Decimal(5, 2)), N'Simple Fresh Picked roses from the garden!', 1)
GO
INSERT [dbo].[FlowerArrangements] ([Id], [Title], [ImageUrl], [Price], [Description], [IsActive]) VALUES (8, N'Red Carnations', N'https://bloomsbythebox.sirv.com/img/product/xlarge/09208A__Carnations_Red_Fancy_Bulk.jpg?q=100', CAST(12.00 AS Decimal(5, 2)), N'Bright Red Carnations', 1)
GO
SET IDENTITY_INSERT [dbo].[FlowerArrangements] OFF
GO
SET IDENTITY_INSERT [dbo].[ProductThemes] ON 
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (1, N'Sports', 1)
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (2, N'Travel', 1)
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (3, N'Dog Lover', 1)
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (4, N'Cat Lover', 1)
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (5, N'Birthday', 1)
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (6, N'Anniversary', 1)
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (7, N'Music Lover', 1)
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (8, N'Star Wars', 1)
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (9, N'Celebration', 1)
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (10, N'Plain', 1)
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (11, N'Seasonal', 1)
GO
INSERT [dbo].[ProductThemes] ([Id], [Theme], [IsActive]) VALUES (12, N'Just Because', 1)
GO
SET IDENTITY_INSERT [dbo].[ProductThemes] OFF
GO
SET IDENTITY_INSERT [dbo].[Products] ON 
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (1, N'Sports-Fan Multi-Flower Arrangement', N'https://sf.tac-cdn.net/images/products/large/T22-2.jpg', 1, CAST(25.00 AS Decimal(5, 2)), N'A baseball themed coffee mug filled with lillies, carnations, and daisies!', 1, 1, 1, CAST(N'2020-11-01T17:07:00.000' AS DateTime), 9)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (2, N'A Happy Arrangement!', N'https://www.1stopflorists.com/images/super/pvii-14249-190404-Be-Happy-BouquetGood-Shown.6.jpg', 9, CAST(30.00 AS Decimal(5, 2)), N'A bright yellow arrangement for any event!', 9, 2, 1, CAST(N'2020-11-01T05:09:00.000' AS DateTime), 4)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (3, N'Gray Mug with sunflowers', N'https://vogtsflowers.imgix.net/images/itemVariation/HurleyFallMug-190413123718.jpg', 10, CAST(30.00 AS Decimal(5, 2)), N'A simple mug with a collection of beautiful flowers!', 10, 2, 1, CAST(N'2020-10-21T05:09:00.000' AS DateTime), 1)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (12, N'Tulsa Cup Arrangement', N'https://asset.bloomnation.com/c_pad,d_vendor:global:catalog:product:image.png,f_auto,fl_preserve_transparency,q_auto/v1563324426/vendor/111/catalog/product/2/0/20181019074944_file_5bca35582ff85.jpg', 2, CAST(15.00 AS Decimal(5, 2)), N'A blue coffee cup filled with blue and yellow flowers!', 2, 2, 1, CAST(N'2020-11-01T04:42:31.000' AS DateTime), 2)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (16, N'Star Wars R2-D2 Arrangement', N'https://www.karinsflorist.com/wp-content/uploads/2017/07/New-Vandor-R2D2.png', 8, CAST(15.00 AS Decimal(5, 2)), N'An arrangment of irises in an R2-D2 cup!', 6, 4, 0, CAST(N'2008-11-11T13:23:44.000' AS DateTime), 0)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (17, N'Birthday Rose Arrangement', N'https://sf.tac-cdn.net/images/products/large/TBC01.jpg', 5, CAST(25.00 AS Decimal(5, 2)), N'Say Happy Birthday with this beautiful bouquet!', 7, 2, 1, CAST(N'2020-10-01T10:00:00.000' AS DateTime), 2)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (18, N'Cat Lover Arrangement', N'https://i.pinimg.com/564x/2c/1c/ce/2c1cce3ad67f145fcef22ff7112f653b.jpg', 4, CAST(32.99 AS Decimal(5, 2)), N'A great selection for a friend who loves their cat!', 11, 5, 0, CAST(N'2020-10-19T05:09:00.000' AS DateTime), 0)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (19, N'White Coffee Mug Arrangement', N'https://cdn.atwilltech.com/flowerdatabase/p/pick-me-up-58fb7aa1b8d09.425.jpg', 10, CAST(27.99 AS Decimal(5, 2)), N'A white mug filled with pink and purple flowers!', 12, 1, 1, CAST(N'2020-11-02T03:09:00.000' AS DateTime), 1)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (20, N'Dog Mug Arrangement', N'https://i.etsystatic.com/14543792/r/il/7fa3b9/1321429005/il_1588xN.1321429005_312k.jpg', 3, CAST(32.99 AS Decimal(5, 2)), N'A white mug filled with pink and purple flowers!', 13, 1, 1, CAST(N'2020-11-01T13:09:00.000' AS DateTime), 1)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (22, N'Fall Arrangement', N'https://images.currentcatalog.com/catalog/product/618550/618550_f1908.jpg', 11, CAST(32.99 AS Decimal(5, 2)), N'A perfect fall arrangement to bring with you for any fall time event!', 14, 6, 1, CAST(N'2020-10-01T13:09:00.000' AS DateTime), 3)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (23, N'Darth Vader Arrangement', N'https://www.karinsflorist.com/wp-content/uploads/2017/07/Darth-Vader-Flower-Mug.png', 8, CAST(32.99 AS Decimal(5, 2)), N'Another great options for any Star Wars fan', 15, 2, 1, CAST(N'2020-10-11T13:09:00.000' AS DateTime), 5)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (24, N'Anniversary Arrangement', N'https://benwhiteflorist.com/wp-content/uploads/2015/10/Love-Mug-1024x1024.jpg', 6, CAST(22.99 AS Decimal(5, 2)), N'Show someone you care with these!', 16, 2, 1, CAST(N'2020-10-15T13:09:00.000' AS DateTime), 2)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (25, N'Simple Anniversary Arrangement', N'https://assets.eflorist.com/site/50006000/assets/products/PHR_/sku7110925.jpg', 6, CAST(24.99 AS Decimal(5, 2)), N'Show someone you care with these!', 17, 2, 1, CAST(N'2020-10-17T13:09:00.000' AS DateTime), 3)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (26, N'Purple Flower Arrangement', N'https://i.etsystatic.com/7918186/r/il/3e20bf/1499394081/il_570xN.1499394081_6i7q.jpg', 10, CAST(18.99 AS Decimal(5, 2)), N'A great gift idea for anyone!', 18, 7, 1, CAST(N'2020-10-17T13:09:00.000' AS DateTime), 2)
GO
INSERT [dbo].[Products] ([Id], [Title], [ImageUrl], [ProductThemeId], [Price], [Description], [CoffeeMugId], [FlowerArrId], [IsActive], [DateCreated], [QuantityAvaliable]) VALUES (27, N'Holiday Arrangement', N'https://i.pinimg.com/originals/08/70/51/08705182f6fb6e4abc665f95cd88ca4b.jpg', 10, CAST(28.99 AS Decimal(5, 2)), N'A great gift to take to your next holiday party!', 19, 8, 1, CAST(N'2020-10-17T13:09:00.000' AS DateTime), 2)
GO
SET IDENTITY_INSERT [dbo].[Products] OFF
GO