CREATE TABLE sales_data (
    id SERIAL PRIMARY KEY,
    product_id INT,
    sale_date DATE,
    quantity INT,
    price NUMERIC(10, 2)
);

INSERT INTO sales_data (product_id, sale_date, quantity, price)
SELECT
    (RANDOM() * 100)::INT AS product_id,
    CURRENT_DATE - (RANDOM() * 30)::INT AS sale_date,
    (RANDOM() * 10)::INT + 1 AS quantity,
    (RANDOM() * 100)::NUMERIC(10,2) + 1 AS price
FROM generate_series(1, 1000) AS s(id); -- 1000行のダミーデータを生成
