-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusers.sql
More file actions
146 lines (144 loc) · 2.62 KB
/
users.sql
File metadata and controls
146 lines (144 loc) · 2.62 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
-- Step 1: Create the 'auth' schema (if not already created)
CREATE SCHEMA IF NOT EXISTS auth;
-- Step 2: Create the 'users' table inside the 'auth' schema with additional fields
CREATE TABLE auth.users (
id SERIAL PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
email VARCHAR(100) NOT NULL UNIQUE,
password_hash VARCHAR(255) NOT NULL,
age INT NOT NULL,
salary DECIMAL(10, 2) NOT NULL,
department VARCHAR(50) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Step 3: Insert 15 users with realistic values into the 'users' table
INSERT INTO
auth.users (
username,
email,
password_hash,
age,
salary,
department
)
VALUES
(
'jdoe',
'jdoe@example.com',
'hash12345',
28,
70000.00,
'Engineering'
),
(
'asmith',
'asmith@example.com',
'hash23456',
35,
85000.00,
'Marketing'
),
(
'mjones',
'mjones@example.com',
'hash34567',
40,
95000.00,
'Sales'
),
(
'lwilson',
'lwilson@example.com',
'hash45678',
30,
65000.00,
'HR'
),
(
'kbrown',
'kbrown@example.com',
'hash56789',
50,
120000.00,
'Finance'
),
(
'tjohnson',
'tjohnson@example.com',
'hash67890',
27,
68000.00,
'Engineering'
),
(
'dlee',
'dlee@example.com',
'hash78901',
42,
105000.00,
'Marketing'
),
(
'wclark',
'wclark@example.com',
'hash89012',
45,
98000.00,
'Sales'
),
(
'arodriguez',
'arodriguez@example.com',
'hash90123',
33,
72000.00,
'HR'
),
(
'tlopez',
'tlopez@example.com',
'hash01234',
29,
110000.00,
'Finance'
),
(
'jmartin',
'jmartin@example.com',
'hash12346',
37,
83000.00,
'Engineering'
),
(
'cwhite',
'cwhite@example.com',
'hash23457',
41,
90000.00,
'Marketing'
),
(
'bperez',
'bperez@example.com',
'hash34568',
38,
75000.00,
'Sales'
),
(
'nlewis',
'nlewis@example.com',
'hash45679',
36,
69000.00,
'HR'
),
(
'mpatel',
'mpatel@example.com',
'hash56780',
47,
130000.00,
'Finance'
);