Wrapping CRUD
Using View
CREATE VIEW vw_ProductPrice AS
SELECT Name, Price
FROM Product
WHERE Supplier = 2;
- View the View we've made.
SELECT * from vw_ProductPrice;
Using Procedure
DELIMITER //
CREATE PROCEDURE GetAllProduct()
BEGIN
SELECT * FROM product;
END //
DELIMITER ;
- To Call the Procedure
CALL GetAllProduct();