-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02-data.sql
More file actions
77 lines (72 loc) · 2.82 KB
/
Copy path02-data.sql
File metadata and controls
77 lines (72 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
-- ============================================
-- 测试数据(15个用户 + 5个分类 + 10个商品 + 30条订单)
-- ============================================
USE ecommerce;
-- 用户(5个南宁 + 5个南昌 + 5个其他)
INSERT INTO t_user (username, phone, city) VALUES
('张三', '13800000001', '南宁'),
('李四', '13800000002', '南宁'),
('王五', '13800000003', '南宁'),
('赵六', '13800000004', '南宁'),
('孙七', '13800000005', '南宁'),
('周八', '13800000006', '南昌'),
('吴九', '13800000007', '南昌'),
('郑十', '13800000008', '南昌'),
('冯一', '13800000009', '南昌'),
('陈二', '13800000010', '南昌'),
('褚三', '13800000011', '桂林'),
('卫四', '13800000012', '柳州'),
('蒋五', '13800000013', '北海'),
('沈六', '13800000014', '玉林'),
('韩七', '13800000015', '梧州');
-- 商品分类
INSERT INTO t_category (id, name, pid) VALUES
(1, '手机数码', 0),
(2, '电脑办公', 0),
(3, '家用电器', 0),
(4, '手机', 1),
(5, '笔记本', 2);
-- 商品
INSERT INTO t_product (name, category_id, price, stock) VALUES
('iPhone 15', 4, 5999.00, 100),
('华为Mate 60', 4, 4999.00, 80),
('小米14', 4, 3999.00, 120),
('OPPO Find X7', 4, 3499.00, 60),
('MacBook Pro 14', 5, 12999.00, 30),
('联想ThinkPad X1', 5, 8999.00, 25),
('戴尔XPS 15', 5, 7999.00, 20),
('格力空调1.5匹', 3, 2999.00, 50),
('美的冰箱', 3, 2499.00, 40),
('海尔洗衣机', 3, 1999.00, 35);
-- 订单(30条,模拟现实购买场景)
INSERT INTO t_order (user_id, product_id, quantity, total_price, order_time) VALUES
(1, 1, 1, 5999.00, '2026-01-15 10:30:00'),
(1, 3, 2, 7998.00, '2026-02-20 14:00:00'),
(2, 2, 1, 4999.00, '2026-01-18 09:00:00'),
(2, 5, 1, 12999.00, '2026-03-05 16:30:00'),
(3, 3, 1, 3999.00, '2026-01-22 11:00:00'),
(3, 4, 3, 10497.00, '2026-04-10 10:00:00'),
(4, 1, 1, 5999.00, '2026-02-01 08:30:00'),
(4, 8, 2, 5998.00, '2026-05-15 13:00:00'),
(5, 2, 1, 4999.00, '2026-02-10 15:00:00'),
(5, 6, 1, 8999.00, '2026-06-01 09:00:00'),
(6, 3, 1, 3999.00, '2026-01-28 10:00:00'),
(6, 7, 1, 7999.00, '2026-03-18 14:30:00'),
(7, 4, 1, 3499.00, '2026-02-14 12:00:00'),
(7, 9, 1, 2499.00, '2026-04-20 16:00:00'),
(8, 1, 2, 11998.00, '2026-03-01 09:00:00'),
(8, 10, 1, 1999.00, '2026-05-01 11:00:00'),
(9, 2, 1, 4999.00, '2026-03-10 10:30:00'),
(9, 5, 1, 12999.00, '2026-06-10 14:00:00'),
(10, 3, 1, 3999.00, '2026-04-01 08:00:00'),
(10, 8, 3, 8997.00, '2026-05-20 17:00:00'),
(11, 4, 1, 3499.00, '2026-04-15 09:30:00'),
(12, 6, 1, 8999.00, '2026-05-05 10:00:00'),
(13, 7, 1, 7999.00, '2026-05-10 11:30:00'),
(14, 9, 2, 4998.00, '2026-06-05 13:00:00'),
(15, 10, 1, 1999.00, '2026-06-15 15:00:00'),
(1, 10, 1, 1999.00, '2026-06-20 08:00:00'),
(2, 4, 1, 3499.00, '2026-06-21 09:30:00'),
(6, 5, 1, 12999.00, '2026-06-22 14:00:00'),
(8, 2, 1, 4999.00, '2026-06-22 16:00:00'),
(9, 3, 2, 7998.00, '2026-06-23 10:00:00');