Skip to content

Instantly share code, notes, and snippets.

@adimyth
Created June 9, 2024 14:35
Show Gist options
  • Save adimyth/fe7ea16dedbd337e6873846f92275edb to your computer and use it in GitHub Desktop.
Save adimyth/fe7ea16dedbd337e6873846f92275edb to your computer and use it in GitHub Desktop.
Superset Pivot Table Test Sample Setup
CREATE TABLE sales (
sale_date DATE,
color VARCHAR(10),
region VARCHAR(10),
quantity INT,
revenue DECIMAL(10, 2)
);
INSERT INTO sales VALUES
('2016-01-01', 'Red', 'North', 1, 13.00),
('2016-01-07', 'Green', 'North', 8, 104.00),
('2016-01-13', 'Red', 'South', 2, 22.00),
('2016-01-21', 'Blue', 'East', 5, 60.00),
('2016-02-01', 'Green', 'West', 2, 26.00),
('2016-02-13', 'Blue', 'East', 8, 96.00),
('2016-02-23', 'Blue', 'North', 7, 84.00),
('2016-02-28', 'Green', 'West', 2, 26.00),
('2016-03-03', 'Blue', 'South', 8, 96.00),
('2016-03-12', 'Green', 'South', 1, 13.00),
('2016-03-16', 'Red', 'East', 8, 88.00),
('2016-03-23', 'Red', 'West', 6, 66.00),
('2016-03-30', 'Green', 'South', 5, 65.00),
('2016-04-09', 'Blue', 'South', 7, 84.00),
('2016-04-16', 'Red', 'South', 5, 55.00),
('2016-04-25', 'Blue', 'South', 1, 12.00),
('2016-04-30', 'Blue', 'North', 4, 48.00),
('2016-05-04', 'Blue', 'North', 7, 84.00),
('2016-05-13', 'Red', 'East', 3, 33.00),
('2016-05-21', 'Blue', 'South', 2, 24.00),
('2016-05-26', 'Blue', 'South', 6, 72.00),
('2016-06-02', 'Red', 'East', 6, 66.00),
('2016-06-08', 'Green', 'West', 1, 13.00),
('2016-06-14', 'Blue', 'East', 8, 96.00),
('2016-06-21', 'Red', 'North', 7, 77.00),
('2016-06-27', 'Green', 'South', 5, 65.00),
('2016-07-03', 'Blue', 'West', 4, 48.00),
('2016-07-09', 'Red', 'South', 3, 33.00),
('2016-07-15', 'Green', 'North', 2, 26.00),
('2016-07-20', 'Blue', 'East', 1, 12.00),
('2016-07-26', 'Red', 'West', 8, 88.00),
('2016-08-01', 'Green', 'South', 6, 78.00),
('2016-08-07', 'Blue', 'West', 5, 60.00),
('2016-08-13', 'Red', 'North', 4, 44.00),
('2016-08-19', 'Green', 'East', 3, 39.00),
('2016-08-25', 'Blue', 'West', 2, 24.00),
('2016-08-31', 'Red', 'South', 1, 11.00),
('2016-09-06', 'Green', 'North', 8, 104.00),
('2016-09-12', 'Blue', 'East', 7, 84.00),
('2016-09-18', 'Red', 'West', 6, 66.00),
('2016-09-25', 'Green', 'South', 5, 65.00),
('2016-10-01', 'Blue', 'North', 4, 52.00),
('2016-10-07', 'Red', 'East', 3, 33.00),
('2016-10-13', 'Green', 'West', 2, 26.00),
('2016-10-19', 'Blue', 'South', 1, 12.00);
SELECT * FROM sales;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment