Saturday, February 13, 2021

Bar and Pie chart in Oracle APEX

CREATE TABLE PRODUCT (ID NUMBER, NAME VARCHAR2(100));
ALTER TABLE PRODUCT ADD CONSTRAINT PRODUCT_PK PRIMARY KEY(ID);
INSERT INTO PRODUCT VALUES(1, 'Iphone');
INSERT INTO PRODUCT VALUES(2, 'Samsung');
INSERT INTO PRODUCT VALUES(3, 'Xiami');
INSERT INTO PRODUCT VALUES(4, 'Lenovo');
INSERT INTO PRODUCT VALUES(5, 'Oppo');
INSERT INTO PRODUCT VALUES(6, 'OnePlus');
INSERT INTO PRODUCT VALUES(7, 'Nokia');
COMMIT;
 

 

CREATE TABLE ORDERS (ID NUMBER, PRODUCT_ID NUMBER, QUANTITY NUMBER, ORDER_DATE DATE);
ALTER TABLE ORDERS ADD CONSTRAINT ORDERS_PK PRIMARY KEY(ID);
ALTER TABLE ORDERS ADD CONSTRAINT ORDERS_FK FOREIGN KEY(PRODUCT_ID) REFERENCES PRODUCT(ID);
INSERT INTO ORDERS VALUES (1,1,20,SYSDATE);
INSERT INTO ORDERS VALUES (2,3,10,'02/13/1992');
INSERT INTO ORDERS VALUES (3,1,40,'03/19/2010');
INSERT INTO ORDERS VALUES (4,1,10,'12/10/1998');
INSERT INTO ORDERS VALUES (5,4,10,'09/18/1992');
INSERT INTO ORDERS VALUES (6,3,50,'02/13/2020');
INSERT INTO ORDERS VALUES (7,1,10,'03/15/1992');
INSERT INTO ORDERS VALUES (8,2,30,'07/19/1992');
INSERT INTO ORDERS VALUES (9,7,10,'02/22/1992');
INSERT INTO ORDERS VALUES (10,7,80,'09/28/2017');
INSERT INTO ORDERS VALUES (11,2,10,'21/28/2019');
COMMIT;

 

PIE Chart SQL:
Application --> Create Page --> Chart --> Pie --> Page Name as Charts (anything) --> SQL Query --> Select LABEL and VALUE --> Create
SELECT P.NAME AS LABEL, COUNT(*) AS VALUE FROM PRODUCT P, ORDERS O WHERE P.ID = O.PRODUCT_ID GROUP BY P.NAME;
 

 

BAR Chart SQL:
Application --> Create Page --> Chart --> Bar --> Page Name as Charts (anything) --> Soucre: Localdatabase ,Type: SQL Query --> Select LABEL and VALUE --> Create
SELECT P.NAME AS LABEL, COUNT(*) AS VALUE FROM PRODUCT P, ORDERS O WHERE P.ID = O.PRODUCT_ID GROUP BY P.NAME;
 

 

Example: https://apex.oracle.com/pls/apex/royal/r/testing40/charts?session=112166733385562

1 comment:

  1. Casino Games - Dr. Majestic Star Entertainment Group - Dr. Majestic Star
    the best casino 광주광역 출장샵 games from our casino floor 논산 출장샵 in 안성 출장안마 Kansas. 거제 출장안마 Experience Vegas-style casino table games 오산 출장샵 like blackjack, craps, roulette, craps,

    ReplyDelete

Delete Row Button to all records of Interactive Report in Oracle Apex

 1. add 'Delete' Del column to Report Query 2. Set the Following Properties for the DEL Column Type: Link Heading: Delete Targ...