Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE products
- (id integer);
- INSERT INTO products
- VALUES (1),
- (2),
- (3);
- CREATE TABLE sellers
- (email varchar);
- INSERT INTO sellers
- VALUES ('email1@gmail.com'),
- ('email2@gmail.com'),
- ('email3@gmail.com');
- CREATE TABLE sales
- (id serial, kedy timestamp, price numeric, product_id integer, seller_id varchar);
- INSERT INTO sales (kedy, price, product_id, seller_id)
- SELECT
- TIMESTAMP '2011-11-11' + floor((random() * 365)) * INTERVAL '1 day',
- floor(random() * 50 + 5)::numeric AS price,
- products.id AS product_id,
- sellers.email AS seller_id
- FROM products, sellers
- WHERE random() > 0.5;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement