0% found this document useful (0 votes)
10 views3 pages

Sample Data

The document contains SQL commands to insert data into various tables including users, products, cart, cart_items, orders, order_items, transactions, and product_history. It includes details such as user roles, product categories, and transaction information. The data covers a range of items like books, CDs, LP records, and DVDs with associated attributes like price, stock quantity, and order status.

Uploaded by

gialinx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Sample Data

The document contains SQL commands to insert data into various tables including users, products, cart, cart_items, orders, order_items, transactions, and product_history. It includes details such as user roles, product categories, and transaction information. The data covers a range of items like books, CDs, LP records, and DVDs with associated attributes like price, stock quantity, and order status.

Uploaded by

gialinx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

-- 1.

Thêm dữ liệu vào bảng users


INSERT INTO users (username, password, email, role, is_blocked, created_at) VALUES
('admin1', 'hashed_password_1', '[email protected]', 'ADMIN', FALSE,
CURRENT_TIMESTAMP),
('admin2', 'hashed_password_2', '[email protected]', 'ADMIN', FALSE,
CURRENT_TIMESTAMP),
('pm1', 'hashed_password_3', '[email protected]', 'PRODUCT_MANAGER', FALSE,
CURRENT_TIMESTAMP),
('pm2', 'hashed_password_4', '[email protected]', 'PRODUCT_MANAGER', FALSE,
CURRENT_TIMESTAMP),
('customer1', 'hashed_password_5', '[email protected]', 'CUSTOMER', FALSE,
CURRENT_TIMESTAMP),
('customer2', 'hashed_password_6', '[email protected]', 'CUSTOMER', TRUE,
CURRENT_TIMESTAMP),
('customer3', 'hashed_password_7', '[email protected]', 'CUSTOMER', FALSE,
CURRENT_TIMESTAMP),
('customer4', 'hashed_password_8', '[email protected]', 'CUSTOMER', FALSE,
CURRENT_TIMESTAMP),
('customer5', 'hashed_password_9', '[email protected]', 'CUSTOMER', FALSE,
CURRENT_TIMESTAMP),
('testuser', 'hashed_password_10', '[email protected]', 'CUSTOMER', FALSE,
CURRENT_TIMESTAMP);

-- 2. Thêm dữ liệu vào bảng products


INSERT INTO products (
title, category, value, price, stock_quantity, is_rush_eligible, weight,
authors, cover_type, publisher, publication_date, num_pages, book_language,
book_genre,
artists, record_label, tracklist, music_genre, release_date,
disc_type, director, runtime, studio, dvd_language, subtitles
) VALUES
-- Books
('The Great Gatsby', 'BOOK', 90000, 100000, 50, TRUE, 0.5,
'F. Scott Fitzgerald', 'PAPERBACK', 'Scribner', '1925-04-10', 180, 'English',
'Fiction',
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
('Pride and Prejudice', 'BOOK', 80000, 95000, 30, FALSE, 0.6,
'Jane Austen', 'HARDCOVER', 'Penguin Books', '1813-01-28', 432, 'English',
'Romance',
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
('1984', 'BOOK', 100000, 110000, 40, TRUE, 0.4,
'George Orwell', 'PAPERBACK', 'Secker & Warburg', '1949-06-08', 328, 'English',
'Dystopian',
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
('To Kill a Mockingbird', 'BOOK', 85000, 90000, 60, TRUE, 0.5,
'Harper Lee', 'HARDCOVER', 'J.B. Lippincott', '1960-07-11', 281, 'English',
'Fiction',
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
-- CDs
('Abbey Road', 'CD', 120000, 130000, 25, FALSE, 0.2,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
'The Beatles', 'Apple Records', 'Come Together, Something, Octopus''s Garden',
'Rock', '1969-09-26',
NULL, NULL, NULL, NULL, NULL, NULL),
('Thriller', 'CD', 110000, 125000, 35, TRUE, 0.2,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
'Michael Jackson', 'Epic Records', 'Billie Jean, Beat It, Thriller', 'Pop', '1982-
11-30',
NULL, NULL, NULL, NULL, NULL, NULL),
-- LP Records
('Dark Side of the Moon', 'LP_RECORD', 150000, 160000, 20, TRUE, 0.4,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
'Pink Floyd', 'Harvest Records', 'Time, Money, Us and Them', 'Rock', '1973-03-01',
NULL, NULL, NULL, NULL, NULL, NULL),
('Led Zeppelin IV', 'LP_RECORD', 140000, 155000, 15, FALSE, 0.4,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
'Led Zeppelin', 'Atlantic Records', 'Stairway to Heaven, Black Dog', 'Rock',
'1971-11-08',
NULL, NULL, NULL, NULL, NULL, NULL),
-- DVDs
('Inception', 'DVD', 130000, 140000, 30, TRUE, 0.3,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
'BLU_RAY', 'Christopher Nolan', 148, 'Warner Bros', 'English', 'English,
Spanish'),
('The Matrix', 'DVD', 120000, 135000, 40, TRUE, 0.3,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
'BLU_RAY', 'Wachowski Sisters', 136, 'Warner Bros', 'English', 'English, French'),
('Pulp Fiction', 'DVD', 115000, 130000, 25, FALSE, 0.3,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
'BLU_RAY', 'Quentin Tarantino', 154, 'Miramax', 'English', 'English, Spanish'),
('Spirited Away', 'DVD', 140000, 150000, 20, TRUE, 0.3,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
'BLU_RAY', 'Hayao Miyazaki', 125, 'Studio Ghibli', 'Japanese', 'English,
Vietnamese');

-- 3. Thêm dữ liệu vào bảng cart


INSERT INTO cart (session_id, created_at) VALUES
('session_001', CURRENT_TIMESTAMP),
('session_002', CURRENT_TIMESTAMP),
('session_003', CURRENT_TIMESTAMP),
('session_004', CURRENT_TIMESTAMP),
('session_005', CURRENT_TIMESTAMP);

-- 4. Thêm dữ liệu vào bảng cart_items


INSERT INTO cart_items (cart_id, product_id, quantity) VALUES
(1, 1, 2), -- 2 cuốn "The Great Gatsby"
(1, 5, 1), -- 1 CD "Abbey Road"
(2, 3, 3), -- 3 cuốn "1984"
(2, 9, 1), -- 1 DVD "Inception"
(3, 7, 2), -- 2 LP "Dark Side of the Moon"
(4, 2, 1), -- 1 cuốn "Pride and Prejudice"
(4, 10, 2), -- 2 DVD "The Matrix"
(5, 6, 1), -- 1 CD "Thriller"
(5, 12, 1); -- 1 DVD "Spirited Away"

-- 5. Thêm dữ liệu vào bảng orders


INSERT INTO orders (
user_id, recipient_name, email, phone_number, delivery_address, province_city,
delivery_fee, is_rush_delivery, rush_delivery_time, total_amount, status,
created_at
) VALUES
(NULL, 'Nguyen Van A', '[email protected]', '0901234567', '123 Tran Hung Dao',
'Hanoi', 22000, FALSE, NULL, 245000, 'PENDING', CURRENT_TIMESTAMP),
(5, 'Tran Thi B', '[email protected]', '0912345678', '456 Le Loi', 'Ho Chi Minh
City', 22000, TRUE, CURRENT_TIMESTAMP + INTERVAL '2 hours', 320000, 'APPROVED',
CURRENT_TIMESTAMP),
(NULL, 'Le Van C', '[email protected]', '0923456789', '789 Nguyen Trai', 'Da Nang',
30000, FALSE, NULL, 190000, 'REJECTED', CURRENT_TIMESTAMP),
(7, 'Pham Thi D', '[email protected]', '0934567890', '101 Hai Ba Trung', 'Hanoi',
32000, TRUE, CURRENT_TIMESTAMP + INTERVAL '2 hours', 450000, 'PENDING',
CURRENT_TIMESTAMP),
(NULL, 'Hoang Van E', '[email protected]', '0945678901', '202 Vo Van Tan', 'Can
Tho', 30000, FALSE, NULL, 135000, 'CANCELED', CURRENT_TIMESTAMP);

-- 6. Thêm dữ liệu vào bảng order_items


INSERT INTO order_items (order_id, product_id, quantity, price) VALUES
(1, 1, 2, 100000), -- 2 cuốn "The Great Gatsby"
(1, 5, 1, 130000), -- 1 CD "Abbey Road"
(2, 9, 1, 140000), -- 1 DVD "Inception"
(2, 7, 2, 160000), -- 2 LP "Dark Side of the Moon"
(3, 3, 2, 110000), -- 2 cuốn "1984"
(4, 2, 1, 95000), -- 1 cuốn "Pride and Prejudice"
(4, 10, 2, 135000), -- 2 DVD "The Matrix"
(5, 6, 1, 125000), -- 1 CD "Thriller"
(5, 12, 1, 150000); -- 1 DVD "Spirited Away"

-- 7. Thêm dữ liệu vào bảng transactions


INSERT INTO transactions (order_id, transaction_vnpay_id, amount, content,
created_at) VALUES
(1, 'VNPAY_001', 245000, 'Payment for order 1', CURRENT_TIMESTAMP),
(2, 'VNPAY_002', 320000, 'Payment for order 2', CURRENT_TIMESTAMP),
(4, 'VNPAY_003', 450000, 'Payment for order 4', CURRENT_TIMESTAMP),
(5, 'VNPAY_004', 135000, 'Refund for order 5', CURRENT_TIMESTAMP);

-- 8. Thêm dữ liệu vào bảng product_history


INSERT INTO product_history (product_id, operation, description, user_id,
created_at) VALUES
(1, 'ADD', 'Added new book: The Great Gatsby', 3, CURRENT_TIMESTAMP),
(5, 'ADD', 'Added new CD: Abbey Road', 3, CURRENT_TIMESTAMP),
(7, 'EDIT', 'Updated stock quantity for Dark Side of the Moon', 4,
CURRENT_TIMESTAMP),
(9, 'ADD', 'Added new DVD: Inception', 3, CURRENT_TIMESTAMP),
(3, 'EDIT', 'Updated price for 1984', 4, CURRENT_TIMESTAMP),
(2, 'ADD', 'Added new book: Pride and Prejudice', 3, CURRENT_TIMESTAMP),
(10, 'DELETE', 'Removed The Matrix due to discontinuation', 4, CURRENT_TIMESTAMP),
(6, 'ADD', 'Added new CD: Thriller', 3, CURRENT_TIMESTAMP),
(12, 'ADD', 'Added new DVD: Spirited Away', 3, CURRENT_TIMESTAMP),
(1, 'EDIT', 'Updated publisher for The Great Gatsby', 4, CURRENT_TIMESTAMP);

You might also like