This repository was archived by the owner on Jan 31, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcar_pgadmin.sql
More file actions
272 lines (212 loc) · 13 KB
/
car_pgadmin.sql
File metadata and controls
272 lines (212 loc) · 13 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
-- Safe re-run: drop existing tables if they exist
BEGIN;
DROP TABLE IF EXISTS public.cars_inventory CASCADE;
DROP TABLE IF EXISTS public.owners CASCADE;
COMMIT;
--
-- PostgreSQL database dump
--
-- Dumped from database version 18.0
-- Dumped by pg_dump version 18.0
-- Started on 2025-11-11 18:28:53
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- TOC entry 220 (class 1259 OID 16390)
-- Name: cars_inventory; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.cars_inventory (
id bigint NOT NULL,
brand character varying(80) NOT NULL,
color character varying(40) NOT NULL,
created_at timestamp(6) with time zone NOT NULL,
car_model character varying(120) NOT NULL,
model_year integer NOT NULL,
price integer NOT NULL,
registration_number character varying(40) NOT NULL,
updated_at timestamp(6) with time zone NOT NULL,
owner_id bigint NOT NULL
);
ALTER TABLE public.cars_inventory OWNER TO CURRENT_USER;
--
-- TOC entry 219 (class 1259 OID 16389)
-- Name: cars_inventory_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
ALTER TABLE public.cars_inventory ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME public.cars_inventory_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- TOC entry 222 (class 1259 OID 16406)
-- Name: owners; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.owners (
id bigint NOT NULL,
created_at timestamp(6) with time zone NOT NULL,
email character varying(255) NOT NULL,
first_name character varying(80) NOT NULL,
last_name character varying(80) NOT NULL,
phone character varying(40),
updated_at timestamp(6) with time zone NOT NULL
);
ALTER TABLE public.owners OWNER TO CURRENT_USER;
--
-- TOC entry 221 (class 1259 OID 16405)
-- Name: owners_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
ALTER TABLE public.owners ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME public.owners_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- TOC entry 5021 (class 0 OID 16390)
-- Dependencies: 220
-- Data for Name: cars_inventory; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.cars_inventory (id, brand, color, created_at, car_model, model_year, price, registration_number, updated_at, owner_id) VALUES
(1, 'Toyota', 'Blue', '2025-11-04 18:56:23.333825-05', 'Corolla', 2020, 21500, 'QC-ALC-001', '2025-11-04 18:56:23.333825-05', 1),
(2, 'Honda', 'White', '2025-11-04 18:56:23.333825-05', 'Civic', 2019, 20500, 'QC-ALC-002', '2025-11-04 18:56:23.333825-05', 1),
(3, 'Tesla', 'Red', '2025-11-04 18:56:23.333825-05', 'Model 3', 2021, 52000, 'QC-ALC-003', '2025-11-04 18:56:23.333825-05', 1),
(4, 'Ford', 'Black', '2025-11-04 18:56:23.333825-05', 'Focus', 2018, 18000, 'QC-ALC-004', '2025-11-04 18:56:23.333825-05', 1),
(5, 'Nissan', 'Silver', '2025-11-04 18:56:23.333825-05', 'Sentra', 2017, 16500, 'QC-ALC-005', '2025-11-04 18:56:23.333825-05', 1),
(6, 'Toyota', 'Gray', '2025-11-04 18:56:23.333825-05', 'Camry', 2021, 25000, 'QC-ROB-001', '2025-11-04 18:56:23.333825-05', 2),
(7, 'BMW', 'Black', '2025-11-04 18:56:23.333825-05', 'X3', 2020, 48000, 'QC-ROB-002', '2025-11-04 18:56:23.333825-05', 2),
(8, 'Audi', 'White', '2025-11-04 18:56:23.333825-05', 'A4', 2019, 43000, 'QC-ROB-003', '2025-11-04 18:56:23.333825-05', 2),
(9, 'Ford', 'Blue', '2025-11-04 18:56:23.333825-05', 'Fusion', 2018, 19000, 'QC-ROB-004', '2025-11-04 18:56:23.333825-05', 2),
(10, 'Chevrolet', 'Silver', '2025-11-04 18:56:23.333825-05', 'Malibu', 2017, 17000, 'QC-ROB-005', '2025-11-04 18:56:23.333825-05', 2),
(11, 'Hyundai', 'Red', '2025-11-04 18:56:23.333825-05', 'Elantra', 2022, 22000, 'QC-MAR-001', '2025-11-04 18:56:23.333825-05', 3),
(12, 'Kia', 'Gray', '2025-11-04 18:56:23.333825-05', 'Optima', 2021, 21000, 'QC-MAR-002', '2025-11-04 18:56:23.333825-05', 3),
(13, 'Volkswagen', 'Blue', '2025-11-04 18:56:23.333825-05', 'Jetta', 2020, 23000, 'QC-MAR-003', '2025-11-04 18:56:23.333825-05', 3),
(14, 'Mazda', 'Black', '2025-11-04 18:56:23.333825-05', 'Mazda3', 2019, 20000, 'QC-MAR-004', '2025-11-04 18:56:23.333825-05', 3),
(15, 'Subaru', 'White', '2025-11-04 18:56:23.333825-05', 'Impreza', 2018, 19500, 'QC-MAR-005', '2025-11-04 18:56:23.333825-05', 3),
(16, 'Tesla', 'White', '2025-11-04 18:56:23.333825-05', 'Model Y', 2022, 68000, 'QC-DAV-001', '2025-11-04 18:56:23.333825-05', 4),
(17, 'Ford', 'Gray', '2025-11-04 18:56:23.333825-05', 'Escape', 2021, 30000, 'QC-DAV-002', '2025-11-04 18:56:23.333825-05', 4),
(18, 'Honda', 'Black', '2025-11-04 18:56:23.333825-05', 'Accord', 2020, 26000, 'QC-DAV-003', '2025-11-04 18:56:23.333825-05', 4),
(19, 'Toyota', 'Red', '2025-11-04 18:56:23.333825-05', 'RAV4', 2019, 27000, 'QC-DAV-004', '2025-11-04 18:56:23.333825-05', 4),
(20, 'Hyundai', 'Blue', '2025-11-04 18:56:23.333825-05', 'Tucson', 2018, 24000, 'QC-DAV-005', '2025-11-04 18:56:23.333825-05', 4),
(21, 'Mazda', 'Gray', '2025-11-04 18:56:23.333825-05', 'CX-5', 2021, 29000, 'QC-SOP-001', '2025-11-04 18:56:23.333825-05', 5),
(22, 'Kia', 'Black', '2025-11-04 18:56:23.333825-05', 'Sportage', 2020, 27000, 'QC-SOP-002', '2025-11-04 18:56:23.333825-05', 5),
(23, 'BMW', 'White', '2025-11-04 18:56:23.333825-05', '330i', 2019, 45000, 'QC-SOP-003', '2025-11-04 18:56:23.333825-05', 5),
(24, 'Audi', 'Silver', '2025-11-04 18:56:23.333825-05', 'Q5', 2018, 42000, 'QC-SOP-004', '2025-11-04 18:56:23.333825-05', 5),
(25, 'Nissan', 'Blue', '2025-11-04 18:56:23.333825-05', 'Altima', 2017, 18000, 'QC-SOP-005', '2025-11-04 18:56:23.333825-05', 5),
(26, 'Chevrolet', 'Blue', '2025-11-04 18:56:23.333825-05', 'Equinox', 2021, 28000, 'QC-JAM-001', '2025-11-04 18:56:23.333825-05', 6),
(27, 'Honda', 'Black', '2025-11-04 18:56:23.333825-05', 'Fit', 2020, 18000, 'QC-JAM-002', '2025-11-04 18:56:23.333825-05', 6),
(28, 'Toyota', 'Gray', '2025-11-04 18:56:23.333825-05', 'Highlander', 2019, 38000, 'QC-JAM-003', '2025-11-04 18:56:23.333825-05', 6),
(29, 'Subaru', 'White', '2025-11-04 18:56:23.333825-05', 'Forester', 2018, 26000, 'QC-JAM-004', '2025-11-04 18:56:23.333825-05', 6),
(30, 'Volkswagen', 'Red', '2025-11-04 18:56:23.333825-05', 'Golf', 2017, 17000, 'QC-JAM-005', '2025-11-04 18:56:23.333825-05', 6),
(31, 'Ford', 'Red', '2025-11-04 18:56:23.333825-05', 'Mustang', 2022, 43000, 'QC-EMM-001', '2025-11-04 18:56:23.333825-05', 7),
(32, 'Chevrolet', 'Yellow', '2025-11-04 18:56:23.333825-05', 'Camaro', 2021, 42000, 'QC-EMM-002', '2025-11-04 18:56:23.333825-05', 7),
(33, 'Dodge', 'Black', '2025-11-04 18:56:23.333825-05', 'Charger', 2020, 35000, 'QC-EMM-003', '2025-11-04 18:56:23.333825-05', 7),
(34, 'Tesla', 'Blue', '2025-11-04 18:56:23.333825-05', 'Model S', 2019, 80000, 'QC-EMM-004', '2025-11-04 18:56:23.333825-05', 7),
(35, 'Toyota', 'Silver', '2025-11-04 18:56:23.333825-05', 'Prius', 2018, 24000, 'QC-EMM-005', '2025-11-04 18:56:23.333825-05', 7),
(36, 'Honda', 'White', '2025-11-04 18:56:23.333825-05', 'CR-V', 2022, 34000, 'QC-DAN-001', '2025-11-04 18:56:23.333825-05', 8),
(37, 'Kia', 'Gray', '2025-11-04 18:56:23.333825-05', 'Sorento', 2021, 32000, 'QC-DAN-002', '2025-11-04 18:56:23.333825-05', 8),
(38, 'Ford', 'Black', '2025-11-04 18:56:23.333825-05', 'Explorer', 2020, 39000, 'QC-DAN-003', '2025-11-04 18:56:23.333825-05', 8),
(39, 'Chevrolet', 'Silver', '2025-11-04 18:56:23.333825-05', 'Tahoe', 2019, 52000, 'QC-DAN-004', '2025-11-04 18:56:23.333825-05', 8),
(40, 'Hyundai', 'Red', '2025-11-04 18:56:23.333825-05', 'Santa Fe', 2018, 28000, 'QC-DAN-005', '2025-11-04 18:56:23.333825-05', 8),
(41, 'Toyota', 'Red', '2025-11-04 18:56:23.333825-05', 'Yaris', 2021, 16000, 'QC-OLI-001', '2025-11-04 18:56:23.333825-05', 9),
(42, 'Mazda', 'White', '2025-11-04 18:56:23.333825-05', 'CX-3', 2020, 20000, 'QC-OLI-002', '2025-11-04 18:56:23.333825-05', 9),
(43, 'Honda', 'Gray', '2025-11-04 18:56:23.333825-05', 'Pilot', 2019, 36000, 'QC-OLI-003', '2025-11-04 18:56:23.333825-05', 9),
(44, 'Subaru', 'Green', '2025-11-04 18:56:23.333825-05', 'Outback', 2018, 29000, 'QC-OLI-004', '2025-11-04 18:56:23.333825-05', 9),
(45, 'BMW', 'Black', '2025-11-04 18:56:23.333825-05', 'X5', 2017, 60000, 'QC-OLI-005', '2025-11-04 18:56:23.333825-05', 9),
(46, 'Audi', 'Black', '2025-11-04 18:56:23.333825-05', 'A6', 2022, 55000, 'QC-MIC-001', '2025-11-04 18:56:23.333825-05', 10),
(47, 'Mercedes', 'White', '2025-11-04 18:56:23.333825-05', 'C300', 2021, 52000, 'QC-MIC-002', '2025-11-04 18:56:23.333825-05', 10),
(48, 'Tesla', 'Silver', '2025-11-04 18:56:23.333825-05', 'Cybertruck', 2024, 90000, 'QC-MIC-003', '2025-11-04 18:56:23.333825-05', 10),
(49, 'Ford', 'Blue', '2025-11-04 18:56:23.333825-05', 'Bronco', 2022, 45000, 'QC-MIC-004', '2025-11-04 18:56:23.333825-05', 10),
(50, 'Toyota', 'Gray', '2025-11-04 18:56:23.333825-05', '4Runner', 2019, 41000, 'QC-MIC-005', '2025-11-04 18:56:23.333825-05', 10);
--
-- TOC entry 5023 (class 0 OID 16406)
-- Dependencies: 222
-- Data for Name: owners; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.owners (id, created_at, email, first_name, last_name, phone, updated_at) VALUES
(1, '2025-11-04 18:56:23.333825-05', 'alice.johnson@example.com', 'Alice', 'Johnson', '514-111-2001', '2025-11-04 18:56:23.333825-05'),
(2, '2025-11-04 18:56:23.333825-05', 'robert.williams@example.com', 'Robert', 'Williams', '514-111-2002', '2025-11-04 18:56:23.333825-05'),
(3, '2025-11-04 18:56:23.333825-05', 'maria.rodriguez@example.com', 'Maria', 'Rodriguez', '514-111-2003', '2025-11-04 18:56:23.333825-05'),
(4, '2025-11-04 18:56:23.333825-05', 'david.smith@example.com', 'David', 'Smith', '514-111-2004', '2025-11-04 18:56:23.333825-05'),
(5, '2025-11-04 18:56:23.333825-05', 'sophia.brown@example.com', 'Sophia', 'Brown', '514-111-2005', '2025-11-04 18:56:23.333825-05'),
(6, '2025-11-04 18:56:23.333825-05', 'james.miller@example.com', 'James', 'Miller', '514-111-2006', '2025-11-04 18:56:23.333825-05'),
(7, '2025-11-04 18:56:23.333825-05', 'emma.davis@example.com', 'Emma', 'Davis', '514-111-2007', '2025-11-04 18:56:23.333825-05'),
(8, '2025-11-04 18:56:23.333825-05', 'daniel.garcia@example.com', 'Daniel', 'Garcia', '514-111-2008', '2025-11-04 18:56:23.333825-05'),
(9, '2025-11-04 18:56:23.333825-05', 'olivia.martinez@example.com', 'Olivia', 'Martinez', '514-111-2009', '2025-11-04 18:56:23.333825-05'),
(10, '2025-11-04 18:56:23.333825-05', 'michael.anderson@example.com', 'Michael', 'Anderson', '514-111-2010', '2025-11-04 18:56:23.333825-05');
--
-- TOC entry 5029 (class 0 OID 0)
-- Dependencies: 219
-- Name: cars_inventory_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.cars_inventory_id_seq', 50, true);
--
-- TOC entry 5030 (class 0 OID 0)
-- Dependencies: 221
-- Name: owners_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.owners_id_seq', 10, true);
--
-- TOC entry 4862 (class 2606 OID 16404)
-- Name: cars_inventory cars_inventory_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.cars_inventory
ADD CONSTRAINT cars_inventory_pkey PRIMARY KEY (id);
--
-- TOC entry 4869 (class 2606 OID 16416)
-- Name: owners owners_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.owners
ADD CONSTRAINT owners_pkey PRIMARY KEY (id);
--
-- TOC entry 4867 (class 2606 OID 16421)
-- Name: cars_inventory uk_car_registration; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.cars_inventory
ADD CONSTRAINT uk_car_registration UNIQUE (registration_number);
--
-- TOC entry 4871 (class 2606 OID 16423)
-- Name: owners uk_owner_email; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.owners
ADD CONSTRAINT uk_owner_email UNIQUE (email);
--
-- TOC entry 4863 (class 1259 OID 16417)
-- Name: idx_brand; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX idx_brand ON public.cars_inventory USING btree (brand);
--
-- TOC entry 4864 (class 1259 OID 16418)
-- Name: idx_model_year; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX idx_model_year ON public.cars_inventory USING btree (model_year);
--
-- TOC entry 4865 (class 1259 OID 16419)
-- Name: idx_owner_id; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX idx_owner_id ON public.cars_inventory USING btree (owner_id);
--
-- TOC entry 4872 (class 2606 OID 16424)
-- Name: cars_inventory fk_car_owner; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.cars_inventory
ADD CONSTRAINT fk_car_owner FOREIGN KEY (owner_id) REFERENCES public.owners(id);
-- Completed on 2025-11-11 18:28:54
--
-- PostgreSQL database dump complete
--