Can u help with this:
-find an item in the database by entering part of its name
-find an item in the database by entering part of its name
SQL:
CREATE TABLE Confectionery (
IDConfect INT IDENTITY NOT NULL PRIMARY KEY,
NameProduct NVARCHAR(50) NOT NULL,
Category INT NOT NULL,
Quantity SMALLINT NOT NULL,
Price DECIMAL(20)
);
CREATE TABLE ConfectioneryCategory (
IDConCat INT IDENTITY NOT NULL PRIMARY KEY,
CategoryName NVARCHAR(50) NOT NULL,
);
CREATE TABLE Sales (
SaleID INT IDENTITY NOT NULL,
Quantity INT NOT NULL,
DateOfSale DATE,
IDPastryChef INT NOT NULL,
IDProduct INT NOT NULL,
PRIMARY KEY(SaleID, IDProduct )
);
CREATE TABLE PastryChef (
IDPC INT IDENTITY NOT NULL PRIMARY KEY,
FirstName NVARCHAR(50),
LastName NVARCHAR(50),
ManifacturedProduct NVARCHAR(50)
);
ALTER TABLE Sales
ADD CONSTRAINT FK_Confectionery_Sales FOREIGN KEY (IDProduct)
REFERENCES Confectionery (IDConfect)
ON DELETE CASCADE
ON UPDATE CASCADE
;
ALTER TABLE Confectionery
ADD CONSTRAINT FK_Confectionery_ConfectioneryCategory FOREIGN KEY (Category)
REFERENCES ConfectioneryCategory (IDConCat)
ON DELETE CASCADE
ON UPDATE CASCADE
;
ALTER TABLE Sales
ADD CONSTRAINT FK_Sales_PastryChef FOREIGN KEY (IDPastryChef)
REFERENCES PastryChef (IDPC)
ON DELETE CASCADE
ON UPDATE CASCADE
;
INSERT INTO ConfectioneryCategory(CategoryName)
VALUES('deep fried'),('diabetic'),('cakes'),('crakers');
--deep fried
INSERT INTO Confectionery(NameProduct,Category,Quantity,Price )
VALUES('Donuts', 1, 50,'0.99');
INSERT INTO Confectionery(NameProduct,Category,Quantity,Price )
VALUES('Luqaimat', 1, 30 ,'4.12');
INSERT INTO Confectionery(NameProduct,Category,Quantity,Price )
VALUES('Tulumba', 1, 28 ,'1.25');
INSERT INTO Confectionery(NameProduct,Category,Quantity,Price )
VALUES('Julbia', 1, 15 ,'1.15');