srikrishna1 commited on
Commit
aa210c0
·
verified ·
1 Parent(s): d8402ae

Upload production_db.sql

Browse files
Files changed (1) hide show
  1. production_db.sql +63 -0
production_db.sql ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- PostgreSQL Production Database Backup
2
+ -- Database: production_db
3
+ -- Created: 2025-01-15
4
+
5
+ -- Create Users Table
6
+ CREATE TABLE users (
7
+ id SERIAL PRIMARY KEY,
8
+ name VARCHAR(100) NOT NULL,
9
+ email VARCHAR(100) UNIQUE NOT NULL,
10
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
11
+ );
12
+
13
+ -- Insert Sample Data
14
+ INSERT INTO users (name, email) VALUES
15
+ ('John Doe', 'john.doe@example.com'),
16
+ ('Jane Smith', 'jane.smith@example.com'),
17
+ ('Bob Johnson', 'bob.johnson@example.com'),
18
+ ('Alice Williams', 'alice.williams@example.com'),
19
+ ('Charlie Brown', 'charlie.brown@example.com');
20
+
21
+ -- Create Products Table
22
+ CREATE TABLE products (
23
+ id SERIAL PRIMARY KEY,
24
+ product_name VARCHAR(200) NOT NULL,
25
+ price DECIMAL(10, 2) NOT NULL,
26
+ stock_quantity INTEGER DEFAULT 0,
27
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
28
+ );
29
+
30
+ -- Insert Product Data
31
+ INSERT INTO products (product_name, price, stock_quantity) VALUES
32
+ ('Laptop', 999.99, 50),
33
+ ('Mouse', 29.99, 200),
34
+ ('Keyboard', 79.99, 150),
35
+ ('Monitor', 299.99, 75),
36
+ ('Headphones', 149.99, 100);
37
+
38
+ -- Create Orders Table
39
+ CREATE TABLE orders (
40
+ id SERIAL PRIMARY KEY,
41
+ user_id INTEGER REFERENCES users(id),
42
+ product_id INTEGER REFERENCES products(id),
43
+ quantity INTEGER NOT NULL,
44
+ total_amount DECIMAL(10, 2) NOT NULL,
45
+ order_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
46
+ );
47
+
48
+ -- Insert Order Data
49
+ INSERT INTO orders (user_id, product_id, quantity, total_amount) VALUES
50
+ (1, 1, 1, 999.99),
51
+ (2, 2, 2, 59.98),
52
+ (3, 3, 1, 79.99),
53
+ (4, 4, 1, 299.99),
54
+ (5, 5, 2, 299.98);
55
+
56
+ -- Create Indexes
57
+ CREATE INDEX idx_users_email ON users(email);
58
+ CREATE INDEX idx_products_name ON products(product_name);
59
+ CREATE INDEX idx_orders_user_id ON orders(user_id);
60
+ CREATE INDEX idx_orders_product_id ON orders(product_id);
61
+
62
+ -- End of backup
63
+