1) ER Diagram for Online Food Order System: Entities: Customer, Restaurant, Order, Food Item, Delivery, Payment, Review Relationships: Customer places Order (one-to-many) Order contains Food Item (many-to-many) Order is delivered by Delivery (one-to-one) Payment is related to Order (one-to-one) Customer writes Review for Restaurant (one-to-many) 2) PL/SQL Procedure to Calculate Square of a Number: CREATE OR REPLACE PROCEDURE calculate_square( num IN NUMBER, square OUT NUMBER ) AS BEGIN square := num * num; END; 3) SQL Queries: A) SELECT supplier_number, supplier_name FROM Suppliers WHERE supplier_name LIKE 'R%'; B) SELECT supplier_name FROM Suppliers WHERE item_supplied = 'Processor' AND city = 'Delhi'; C) SELECT DISTINCT S.supplier_name FROM Suppliers S JOIN Suppliers R ON S.item_supplied = R.item_supplied WHERE R.supplier_name = 'Ramesh'; D) UPDATE Items SET item_price = item_price + 200 WHERE item_name = 'Keyboard'; E) SELECT supplier_number, supplier_name, item_price FROM Suppliers WHERE city = 'Delhi' ORDER BY item_price ASC; F) ALTER TABLE Suppliers ADD contact_no VARCHAR2(20); G) DELETE FROM Items WHERE item_price = (SELECT MIN(item_price) FROM Items); H) CREATE VIEW SupplierDetails AS SELECT supplier_number, supplier_name FROM Suppliers;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter