Database Management Assignment 2
Database Management Assignment 2
OUTLET
PK_Outlet_ID
Province
District
City
Address
Telephone_No
CREATE TABLE OUTLET (pk_Outlet_Id INT GENERATED BY DEFAULT ON NULL AS IDENTITY, Province
VARCHAR2(15), District VARCHAR2(15), City VARCHAR2(15), Address VARCHAR2(50),
Telephone_No INT,
CONSTRAINT Outlet_Id_Length CHECK (pk_Outlet_Id >= 0000 and pk_Outlet_Id <= 9999 ),
CONSTRAINT Telephone_No_Length CHECK (Telephone_No >= 0000000000 and Telephone_No <=
9999999999 ),
CONSTRAINT pk_outlet PRIMARY KEY (pk_Outlet_Id) );
PRODUCT TABLE
PRODUCT
PK_Product_ID
PK_Outlet_ID
Product_Name
FK_Supplier_ID
FK_Category_ID
Min_Stock_Level
4.b) Fetch the product details of only the products those products that
have been deployed across all outlets in the district of Colombo.
SELECT *
FROM PRODUCT
INNER JOIN OUTLET ON PRODUCT.PK_OUTLET_ID = OUTLET.PK_OUTLET_ID
WHERE OUTLET.DISTRICT = 'Colombo' ;
4.c) Find the total value of sales per store per month.
1)Enable read only access to the view for the secondary account and show
evidence of your grant by querying the Oracle data dictionary for
privileges granted by you.
*GRANT SELECT PREVILEGE TO VIEW SKU_OUTLET_VIEW.
GRANT SELECT ON SKU_OUTLET_VIEW TO CBO12267_S;
2) Change the Privilege for the secondary account to permit updates to
the view. Test the privilege using your ‘2’ account and while logged
in as ‘_2’ use the data dictionary to show the privilege that the
‘_2’ account now has.
3. Once the Redaction Policy is created, the first four digits of the
NIC column in the CUSTOMER table will be redacted for users who do
not have the necessary privileges to view the original data .