2. Manipulating Data
Activity 2.01: Inserting Additional values to the Products Table
Solution:
- Create the
FoodProducts
table with default values:CREATE TABLE FoodProducts ( ProductID INT NOT NULL AUTO_INCREMENT, ProductCategoryID INT NOT NULL DEFAULT 1, SupplierID INT NOT NULL DEFAULT 1, ProductName CHAR(50) NOT NULL, NetRetailPrice DECIMAL(10, 2) NULL DEFAULT 5.99, AvailableQuantity INT NOT NULL, WholesalePrice DECIMAL(10, 2) NOT NULL DEFAULT 3.99, UnitKGWeight DECIMAL(10, 5) NULL, Notes VARCHAR(750) NULL, PRIMARY KEY (ProductID) );
- Insert multiple values:
insert into FoodProducts ( ProductName, AvailableQuantity, UnitKGWeight, Notes ) values ('Pancake batter', 50, 0.25, 'Contains eggs'), ('Breakfast cereal', 10, 0.25, 'Add milk'), ('Siracha sauce', 10, 0.25, 'Spicey');
- Observe the result:
select * from foodProducts;
Your output should be as follows: