1SELECT * -- Total invoices per gender
2FROM (
3 SELECT invoice, gender
4 FROM sales
5) d
6PIVOT (
7 sum(invoice)
8 FOR gender IN ('F' AS "Women", 'M' AS "Men")
9);
10-- Table Sales:
11CREATE TABLE sales (
12 gender VARCHAR2(1 BYTE), -- 'F' or 'M'
13 invoice NUMBER
14);