Complete code:
create database CompanyDB;
use CompanyDB;
drop database CompanyDB;
create table Products(
ProductID INT PRIMARY KEY,
ProductName VARCHAR(255),
SupplierID INT,
CategoryID INT,
QuantityPerUnit VARCHAR(255),
UnitPrice DECIMAL(10, 2),
UnitsInStock INT,
UnitsOnOrder INT,
ReorderLevel INT
);
drop table Products;
CREATE TABLE Products (
ProductID INT PRIMARY KEY,
ProductName VARCHAR(255),
SupplierID INT,
CategoryID INT,
QuantityPerUnit VARCHAR(255),
UnitPrice DECIMAL(10, 2),
UnitsInStock INT,
UnitsOnOrder INT,
ReorderLevel INT
);
TRUNCATE TABLE Products;
alter table Products
add UNIQUE (ProductID);
alter table Products
add primary key (ProductID);
alter table Products
add constraint UnitPricechecker CHECK (UnitPrice > 0);
select * from Products;
ALTER TABLE Products
ALTER COLUMN ReorderLevel DEFAULT 10;
ALTER TABLE Products
ADD ExpirationDate DATE;
ALTER TABLE Products
ALTER COLUMN QuantityPerUnit VARCHAR(500);