-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path2021-03-05_Postgresql-Cheat-Sheet-718b813d3e31.html
More file actions
570 lines (567 loc) · 51.8 KB
/
Copy path2021-03-05_Postgresql-Cheat-Sheet-718b813d3e31.html
File metadata and controls
570 lines (567 loc) · 51.8 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Postgresql Cheat Sheet</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<article class="h-entry">
<header>
<h1 class="p-name">Postgresql Cheat Sheet</h1>
</header>
<section data-field="subtitle" class="p-summary">
PostgreSQL commands
</section>
<section data-field="body" class="e-content">
<section name="4dd8" class="section section--body section--first">
<div class="section-divider">
<hr class="section-divider">
</div>
<div class="section-content">
<div class="section-inner sectionLayout--insetColumn">
<h4 name="ecf9" id="ecf9" class="graf graf--h4 graf--leading graf--kicker"><a
href="http://medium.com/codex" data-href="http://medium.com/codex"
class="markup--anchor markup--h4-anchor">CODEX</a></h4>
<h3 name="9caf" id="9caf" class="graf graf--h3 graf-after--h4 graf--title">PostgreSQL Cheat Sheet</h3>
<h4 name="018d" id="018d" class="graf graf--h4 graf-after--h3 graf--subtitle"><strong
class="markup--strong markup--h4-strong">Each table is made up of rows and columns. If you think of a
table as a grid, the column go from left to right across the grid and each entry of data is listed
down as a row.</strong></h4>
<p name="971d" id="971d" class="graf graf--p graf-after--h4">Each row in a relational is uniquely
identified by a primary key. This can be by one or more sets of column values. In most scenarios it is a
single column, such as employeeID.</p>
<p name="3b2c" id="3b2c" class="graf graf--p graf-after--p">Every relational table has one primary key.
Its purpose is to uniquely identify each row in the database. No two rows can have the same primary key
value. The practical result of this is that you can select every single row by just knowing its primary
key.</p>
<p name="7148" id="7148" class="graf graf--p graf-after--p">SQL Server UNIQUE constraints allow you to
ensure that the data stored in a column, or a group of columns, is unique among the rows in a table.</p>
<p name="442f" id="442f" class="graf graf--p graf-after--p">Although both UNIQUE and <a
href="https://www.sqlservertutorial.net/sql-server-basics/sql-server-primary-key/"
data-href="https://www.sqlservertutorial.net/sql-server-basics/sql-server-primary-key/"
class="markup--anchor markup--p-anchor" rel="noopener" target="_blank">PRIMARY KEY</a> constraints
enforce the uniqueness of data, you should use the UNIQUE constraint instead of PRIMARY KEY constraint
when you want to enforce the uniqueness of a column, or a group of columns, that are not the primary key
columns.</p>
<p name="42d5" id="42d5" class="graf graf--p graf-after--p">Different from PRIMARY KEY constraints, UNIQUE
constraints allow NULL. Moreover, UNIQUE constraints treat the NULL as a regular value, therefore, it
only allows one NULL per column.</p>
<figure name="51b7" id="51b7" class="graf graf--figure graf-after--p"><img class="graf-image"
data-image-id="1*kgzq5NoL5ejBGvuZ4qLDaQ.png" data-width="716" data-height="669"
src="https://cdn-images-1.medium.com/max/800/1*kgzq5NoL5ejBGvuZ4qLDaQ.png"></figure>
<figure name="241b" id="241b" class="graf graf--figure graf-after--figure"><img class="graf-image"
data-image-id="1*hr8DccnpiR2Uj5UI3iLsOQ.png" data-width="726" data-height="640"
src="https://cdn-images-1.medium.com/max/800/1*hr8DccnpiR2Uj5UI3iLsOQ.png"></figure>
<figure name="8485" id="8485" class="graf graf--figure graf-after--figure"><img class="graf-image"
data-image-id="1*RiWJpwpVMdge3Sqofn3srA.png" data-width="890" data-height="353"
src="https://cdn-images-1.medium.com/max/800/1*RiWJpwpVMdge3Sqofn3srA.png"></figure>
<figure name="d812" id="d812" class="graf graf--figure graf-after--figure"><img class="graf-image"
data-image-id="1*GN5aSwENOvntpfk90rHYFg.png" data-width="912" data-height="412"
src="https://cdn-images-1.medium.com/max/800/1*GN5aSwENOvntpfk90rHYFg.png"></figure>
<p name="4daf" id="4daf" class="graf graf--p graf-after--figure">Create a new <a
href="https://www.postgresqltutorial.com/postgresql-roles/"
data-href="https://www.postgresqltutorial.com/postgresql-roles/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">role</a>:</p>
<pre name="bb13" id="bb13"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">CREATE ROLE role_name;</code></pre>
<p name="3ef7" id="3ef7" class="graf graf--p graf-after--pre">Create a new role with a <code
class="markup--code markup--p-code">username</code> and <code
class="markup--code markup--p-code">password</code>:</p>
<pre name="e768" id="e768"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">CREATE ROLE username NOINHERIT LOGIN PASSWORD password;</code></pre>
<p name="f4db" id="f4db" class="graf graf--p graf-after--pre">Change role for the current session to the
<code class="markup--code markup--p-code">new_role</code>:</p>
<pre name="6185" id="6185"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SET ROLE new_role;</code></pre>
<p name="1285" id="1285" class="graf graf--p graf-after--pre">Allow <code
class="markup--code markup--p-code">role_1</code> to set its role as <code
class="markup--code markup--p-code">role_2:</code></p>
<pre name="6e80" id="6e80"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">GRANT role_2 TO role_1;</code></pre>
<h3 name="2186" id="2186" class="graf graf--h3 graf-after--pre">Managing databases</h3>
<p name="666f" id="666f" class="graf graf--p graf-after--h3"><a
href="https://www.postgresqltutorial.com/postgresql-create-database/"
data-href="https://www.postgresqltutorial.com/postgresql-create-database/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Create a new
database</a>:</p>
<pre name="af0e" id="af0e"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">CREATE DATABASE [IF NOT EXISTS] db_name;</code></pre>
<p name="cbfe" id="cbfe" class="graf graf--p graf-after--pre"><a
href="https://www.postgresqltutorial.com/postgresql-drop-database/"
data-href="https://www.postgresqltutorial.com/postgresql-drop-database/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Delete a database
permanently</a>:</p>
<pre name="948c" id="948c"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">DROP DATABASE [IF EXISTS] db_name;</code></pre>
<h3 name="d0fc" id="d0fc" class="graf graf--h3 graf-after--pre">Managing tables</h3>
<p name="9f94" id="9f94" class="graf graf--p graf-after--h3"><a
href="https://www.postgresqltutorial.com/postgresql-create-table/"
data-href="https://www.postgresqltutorial.com/postgresql-create-table/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Create a new table</a>
or a <a href="https://www.postgresqltutorial.com/postgresql-temporary-table/"
data-href="https://www.postgresqltutorial.com/postgresql-temporary-table/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">temporary table</a>
</p>
<pre name="75fd" id="75fd"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">CREATE [TEMP] TABLE [IF NOT EXISTS] table_name(<br> pk SERIAL PRIMARY KEY,<br> c1 type(size) NOT NULL,<br> c2 type(size) NULL,<br> ...<br>);</code></pre>
<p name="8b5f" id="8b5f" class="graf graf--p graf-after--pre"><a
href="https://www.postgresqltutorial.com/postgresql-add-column/"
data-href="https://www.postgresqltutorial.com/postgresql-add-column/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Add a new column</a>
to a table:</p>
<pre name="a356" id="a356"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">ALTER TABLE table_name ADD COLUMN new_column_name TYPE;</code></pre>
<p name="f1a9" id="f1a9" class="graf graf--p graf-after--pre"><a
href="https://www.postgresqltutorial.com/postgresql-drop-column/"
data-href="https://www.postgresqltutorial.com/postgresql-drop-column/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Drop a column</a> in a
table:</p>
<pre name="fa80" id="fa80"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">ALTER TABLE table_name DROP COLUMN column_name;</code></pre>
<p name="50e2" id="50e2" class="graf graf--p graf-after--pre"><a
href="https://www.postgresqltutorial.com/postgresql-rename-column/"
data-href="https://www.postgresqltutorial.com/postgresql-rename-column/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Rename a column</a>:
</p>
<pre name="c506" id="c506"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">ALTER TABLE table_name RENAME column_name TO new_column_name;</code></pre>
<p name="5e01" id="5e01" class="graf graf--p graf-after--pre">Set or remove a default value for a column:
</p>
<pre name="b38b" id="b38b"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">ALTER TABLE table_name ALTER COLUMN [SET DEFAULT value | DROP DEFAULT]</code></pre>
<p name="0eb8" id="0eb8" class="graf graf--p graf-after--pre">Add a <a
href="https://www.postgresqltutorial.com/postgresql-primary-key/"
data-href="https://www.postgresqltutorial.com/postgresql-primary-key/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">primary key </a>to a
table.</p>
<pre name="0d8f" id="0d8f"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">ALTER TABLE table_name ADD PRIMARY KEY (column,...);</code></pre>
<p name="8f8a" id="8f8a" class="graf graf--p graf-after--pre">Remove the primary key from a table.</p>
<pre name="372c" id="372c"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">ALTER TABLE table_name<br>DROP CONSTRAINT primary_key_constraint_name;</code></pre>
<p name="6bff" id="6bff" class="graf graf--p graf-after--pre"><a
href="https://www.postgresqltutorial.com/postgresql-rename-table/"
data-href="https://www.postgresqltutorial.com/postgresql-rename-table/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Rename a table</a>.
</p>
<pre name="fbf5" id="fbf5"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">ALTER TABLE table_name RENAME TO new_table_name;</code></pre>
<p name="57f3" id="57f3" class="graf graf--p graf-after--pre"><a
href="https://www.postgresqltutorial.com/postgresql-drop-table/"
data-href="https://www.postgresqltutorial.com/postgresql-drop-table/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Drop a table</a> and
its dependent objects:</p>
<pre name="274e" id="274e"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">DROP TABLE [IF EXISTS] table_name CASCADE;</code></pre>
<h3 name="ed6b" id="ed6b" class="graf graf--h3 graf-after--pre">Managing views</h3>
<p name="fb2b" id="fb2b" class="graf graf--p graf-after--h3"><a
href="https://www.postgresqltutorial.com/managing-postgresql-views/"
data-href="https://www.postgresqltutorial.com/managing-postgresql-views/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Create a view</a>:</p>
<pre name="2f52" id="2f52"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">CREATE OR REPLACE view_name AS<br>query;</code></pre>
<p name="8ea5" id="8ea5" class="graf graf--p graf-after--pre"><a
href="https://www.postgresqltutorial.com/postgresql-recursive-view/"
data-href="https://www.postgresqltutorial.com/postgresql-recursive-view/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Create a recursive
view</a>:</p>
<pre name="828e" id="828e"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">CREATE RECURSIVE VIEW view_name(column_list) AS<br>SELECT column_list;</code></pre>
<p name="947a" id="947a" class="graf graf--p graf-after--pre"><a
href="https://www.postgresqltutorial.com/postgresql-materialized-views/"
data-href="https://www.postgresqltutorial.com/postgresql-materialized-views/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Create a materialized
view</a>:</p>
<pre name="464e" id="464e"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">CREATE MATERIALIZED VIEW view_name<br>AS<br>query<br>WITH [NO] DATA;</code></pre>
<p name="d25f" id="d25f" class="graf graf--p graf-after--pre">Refresh a materialized view:</p>
<pre name="0876" id="0876"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">REFRESH MATERIALIZED VIEW CONCURRENTLY view_name;</code></pre>
<p name="dc43" id="dc43" class="graf graf--p graf-after--pre">Drop a view:</p>
<pre name="2619" id="2619"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">DROP VIEW [ IF EXISTS ] view_name;</code></pre>
<p name="1984" id="1984" class="graf graf--p graf-after--pre">Drop a materialized view:</p>
<pre name="300e" id="300e"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">DROP MATERIALIZED VIEW view_name;</code></pre>
<p name="5ee2" id="5ee2" class="graf graf--p graf-after--pre">Rename a view:</p>
<pre name="4f15" id="4f15"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">ALTER VIEW view_name RENAME TO new_name;</code></pre>
<h3 name="83a6" id="83a6" class="graf graf--h3 graf-after--pre">Managing indexes</h3>
<p name="bc5e" id="bc5e" class="graf graf--p graf-after--h3">Creating an index with the specified name on
a table</p>
<pre name="2c66" id="2c66"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">CREATE [UNIQUE] INDEX index_name<br>ON table (column,...)</code></pre>
<p name="b329" id="b329" class="graf graf--p graf-after--pre">Removing a specified index from a table</p>
<pre name="895b" id="895b"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">DROP INDEX index_name;</code></pre>
<h3 name="fe6a" id="fe6a" class="graf graf--h3 graf-after--pre">Querying data from tables</h3>
<p name="6138" id="6138" class="graf graf--p graf-after--h3">Query all data from a table:</p>
<pre name="39e6" id="39e6"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT * FROM table_name;</code></pre>
<p name="ea5b" id="ea5b" class="graf graf--p graf-after--pre">Query data from specified columns of all
rows in a table:</p>
<pre name="cf17" id="cf17"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT column_list<br>FROM table;</code></pre>
<p name="eaec" id="eaec" class="graf graf--p graf-after--pre">Query data and select only unique rows:</p>
<pre name="a094" id="a094"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT DISTINCT (column)<br>FROM table;</code></pre>
<p name="7147" id="7147" class="graf graf--p graf-after--pre">Query data from a table with a filter:</p>
<pre name="77ee" id="77ee"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT *<br>FROM table<br>WHERE condition;</code></pre>
<p name="021f" id="021f" class="graf graf--p graf-after--pre">Assign an <a
href="https://www.postgresqltutorial.com/postgresql-alias/"
data-href="https://www.postgresqltutorial.com/postgresql-alias/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">alias</a> to a column
in the result set:</p>
<pre name="fa48" id="fa48"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT column_1 AS new_column_1, ...<br>FROM table;</code></pre>
<p name="f4d7" id="f4d7" class="graf graf--p graf-after--pre">Query data using the <code
class="markup--code markup--p-code"><a href="https://www.postgresqltutorial.com/postgresql-like/"
data-href="https://www.postgresqltutorial.com/postgresql-like/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">LIKE</a></code>
operator:</p>
<pre name="78a0" id="78a0"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT * FROM table_name<br>WHERE column LIKE '%value%'</code></pre>
<p name="79b2" id="79b2" class="graf graf--p graf-after--pre">Query data using the <code
class="markup--code markup--p-code u-paddingRight0 u-marginRight0"><a
href="https://www.postgresqltutorial.com/postgresql-between/"
data-href="https://www.postgresqltutorial.com/postgresql-between/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">BETWEEN</a>
</code>operator:</p>
<pre name="4d45" id="4d45"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT * FROM table_name<br>WHERE column BETWEEN low AND high;</code></pre>
<p name="006a" id="006a" class="graf graf--p graf-after--pre">Query data using the <code
class="markup--code markup--p-code u-paddingRight0 u-marginRight0"><a
href="https://www.postgresqltutorial.com/postgresql-in/"
data-href="https://www.postgresqltutorial.com/postgresql-in/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">IN</a>
</code>operator:</p>
<pre name="5367" id="5367"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT * FROM table_name<br>WHERE column IN (value1, value2,...);</code></pre>
<p name="40b8" id="40b8" class="graf graf--p graf-after--pre">Constrain the returned rows with the <code
class="markup--code markup--p-code"><a href="https://www.postgresqltutorial.com/postgresql-limit/"
data-href="https://www.postgresqltutorial.com/postgresql-limit/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">LIMIT</a></code>
clause:</p>
<pre name="58d9" id="58d9"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT * FROM table_name<br>LIMIT limit OFFSET offset<br>ORDER BY column_name;</code></pre>
<p name="266a" id="266a" class="graf graf--p graf-after--pre">Query data from multiple using the <a
href="https://www.postgresqltutorial.com/postgresql-inner-join/"
data-href="https://www.postgresqltutorial.com/postgresql-inner-join/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">inner join</a>, <a
href="https://www.postgresqltutorial.com/postgresql-left-join/"
data-href="https://www.postgresqltutorial.com/postgresql-left-join/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">left join</a>, <a
href="https://www.postgresqltutorial.com/postgresql-full-outer-join/"
data-href="https://www.postgresqltutorial.com/postgresql-full-outer-join/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">full outer join</a>,
<a href="https://www.postgresqltutorial.com/postgresql-cross-join/"
data-href="https://www.postgresqltutorial.com/postgresql-cross-join/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">cross join</a> and <a
href="https://www.postgresqltutorial.com/postgresql-natural-join/"
data-href="https://www.postgresqltutorial.com/postgresql-natural-join/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">natural join</a>:</p>
<pre name="2a98" id="2a98"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT *<br>FROM table1<br>INNER JOIN table2 ON conditions<br>SELECT *<br>FROM table1<br>LEFT JOIN table2 ON conditions<br>SELECT *<br>FROM table1<br>FULL OUTER JOIN table2 ON conditions<br>SELECT *<br>FROM table1<br>CROSS JOIN table2;<br>SELECT *<br>FROM table1<br>NATURAL JOIN table2;</code></pre>
<p name="d666" id="d666" class="graf graf--p graf-after--pre">Return the number of rows of a table.</p>
<pre name="4262" id="4262"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT COUNT (*)<br>FROM table_name;</code></pre>
<p name="09ca" id="09ca" class="graf graf--p graf-after--pre">Sort rows in ascending or descending order:
</p>
<pre name="6901" id="6901"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT select_list<br>FROM table<br>ORDER BY column ASC [DESC], column2 ASC [DESC],...;</code></pre>
<p name="0667" id="0667" class="graf graf--p graf-after--pre">Group rows using <code
class="markup--code markup--p-code"><a href="https://www.postgresqltutorial.com/postgresql-group-by/"
data-href="https://www.postgresqltutorial.com/postgresql-group-by/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">GROUP BY</a></code>
clause.</p>
<pre name="c594" id="c594"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT *<br>FROM table<br>GROUP BY column_1, column_2, ...;</code></pre>
<p name="b5c6" id="b5c6" class="graf graf--p graf-after--pre">Filter groups using the <code
class="markup--code markup--p-code"><a href="https://www.postgresqltutorial.com/postgresql-having/"
data-href="https://www.postgresqltutorial.com/postgresql-having/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">HAVING</a></code>
clause.</p>
<pre name="6a2a" id="6a2a"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT *<br>FROM table<br>GROUP BY column_1<br>HAVING condition;</code></pre>
<h3 name="7e5a" id="7e5a" class="graf graf--h3 graf-after--pre">Set operations</h3>
<p name="73cb" id="73cb" class="graf graf--p graf-after--h3">Combine the result set of two or more queries
with <code class="markup--code markup--p-code"><a
href="https://www.postgresqltutorial.com/postgresql-union/"
data-href="https://www.postgresqltutorial.com/postgresql-union/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">UNION</a></code>
operator:</p>
<pre name="f700" id="f700"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT * FROM table1<br>UNION<br>SELECT * FROM table2;</code></pre>
<p name="95ad" id="95ad" class="graf graf--p graf-after--pre">Minus a result set using <code
class="markup--code markup--p-code"><a
href="https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-except/"
data-href="https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-except/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">EXCEPT</a></code>
operator:</p>
<pre name="cb48" id="cb48"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT * FROM table1<br>EXCEPT<br>SELECT * FROM table2;</code></pre>
<p name="f331" id="f331" class="graf graf--p graf-after--pre">Get intersection of the result sets of two
queries:</p>
<pre name="f2da" id="f2da"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT * FROM table1<br>INTERSECT<br>SELECT * FROM table2;</code></pre>
<h3 name="e0ef" id="e0ef" class="graf graf--h3 graf-after--pre">Modifying data</h3>
<p name="7d2c" id="7d2c" class="graf graf--p graf-after--h3"><a
href="https://www.postgresqltutorial.com/postgresql-insert/"
data-href="https://www.postgresqltutorial.com/postgresql-insert/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Insert a new row into
a table</a>:</p>
<pre name="a553" id="a553"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">INSERT INTO table(column1,column2,...)<br>VALUES(value_1,value_2,...);</code></pre>
<p name="7ea9" id="7ea9" class="graf graf--p graf-after--pre">Insert multiple rows into a table:</p>
<pre name="8589" id="8589"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">INSERT INTO table_name(column1,column2,...)<br>VALUES(value_1,value_2,...),<br> (value_1,value_2,...),<br> (value_1,value_2,...)...</code></pre>
<p name="0276" id="0276" class="graf graf--p graf-after--pre"><a
href="https://www.postgresqltutorial.com/postgresql-update/"
data-href="https://www.postgresqltutorial.com/postgresql-update/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Update</a> data for
all rows:</p>
<pre name="dc14" id="dc14"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">UPDATE table_name<br>SET column_1 = value_1,<br> ...;</code></pre>
<p name="89b5" id="89b5" class="graf graf--p graf-after--pre">Update data for a set of rows specified by a
condition in the <code class="markup--code markup--p-code">WHERE</code> clause.</p>
<pre name="11d0" id="11d0"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">UPDATE table<br>SET column_1 = value_1,<br> ...<br>WHERE condition;</code></pre>
<p name="2476" id="2476" class="graf graf--p graf-after--pre"><a
href="https://www.postgresqltutorial.com/postgresql-delete/"
data-href="https://www.postgresqltutorial.com/postgresql-delete/"
class="markup--anchor markup--p-anchor" rel="nofollow noopener" target="_blank">Delete all rows</a> of
a table:</p>
<pre name="f046" id="f046"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">DELETE FROM table_name;</code></pre>
<p name="4d15" id="4d15" class="graf graf--p graf-after--pre">Delete specific rows based on a condition:
</p>
<pre name="1630" id="1630"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">DELETE FROM table_name<br>WHERE condition;</code></pre>
<h3 name="c963" id="c963" class="graf graf--h3 graf-after--pre">Performance</h3>
<p name="63cc" id="63cc" class="graf graf--p graf-after--h3">Show the query plan for a query:</p>
<pre name="6f6a" id="6f6a"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">EXPLAIN query;</code></pre>
<p name="81c0" id="81c0" class="graf graf--p graf-after--pre">Show and execute the query plan for a query:
</p>
<pre name="15c8" id="15c8"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">EXPLAIN ANALYZE query;</code></pre>
<p name="890c" id="890c" class="graf graf--p graf-after--pre">Collect statistics:</p>
<pre name="bfe0" id="bfe0"
class="graf graf--pre graf-after--p graf--trailing"><code class="markup--code markup--pre-code">ANALYZE table_name;</code></pre>
</div>
</div>
</section>
<section name="a234" class="section section--body section--last">
<div class="section-divider">
<hr class="section-divider">
</div>
<div class="section-content">
<div class="section-inner sectionLayout--insetColumn">
<h3 name="da6f" id="da6f" class="graf graf--h3 graf--leading">Postgres & JSON:</h3>
<h3 name="1d65" id="1d65" class="graf graf--h3 graf-after--h3">Creating the DB and the Table</h3>
<pre name="c75d" id="c75d"
class="graf graf--pre graf-after--h3"><code class="markup--code markup--pre-code">DROP DATABASE IF EXISTS books_db;<br>CREATE DATABASE books_db WITH ENCODING='UTF8' TEMPLATE template0;</code></pre>
<pre name="4851" id="4851"
class="graf graf--pre graf-after--pre"><code class="markup--code markup--pre-code">DROP TABLE IF EXISTS books;</code></pre>
<pre name="8bc3" id="8bc3"
class="graf graf--pre graf-after--pre"><code class="markup--code markup--pre-code">CREATE TABLE books (<br> id SERIAL PRIMARY KEY,<br> client VARCHAR NOT NULL,<br> data JSONb NOT NULL<br>);</code></pre>
<h3 name="4d07" id="4d07" class="graf graf--h3 graf-after--pre">Populating the DB</h3>
<pre name="e5f6" id="e5f6"
class="graf graf--pre graf-after--h3">INSERT INTO books(client, data) values( 'Joe', '{ "title": "Siddhartha", "author": { "first_name": "Herman", "last_name": "Hesse" } }' ); INSERT INTO books(client, data) values('Jenny', '{ "title": "Bryan Guner", "author": { "first_name": "Jack", "last_name": "Kerouac" } }'); INSERT INTO books(client, data) values('Jenny', '{ "title": "100 años de soledad", "author": { "first_name": "Gabo", "last_name": "Marquéz" } }');</pre>
<p name="cb97" id="cb97" class="graf graf--p graf-after--pre">Lets see everything inside the table books:
</p>
<pre name="dfe6" id="dfe6"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT * FROM books;</code></pre>
<p name="2019" id="2019" class="graf graf--p graf-after--pre">Output:</p>
<figure name="6d2e" id="6d2e" class="graf graf--figure graf-after--p"><img class="graf-image"
data-image-id="0*GOQQ0qNGak2yIrtQ" data-width="794" data-height="87"
src="https://cdn-images-1.medium.com/max/800/0*GOQQ0qNGak2yIrtQ"></figure>
<h3 name="afcf" id="afcf" class="graf graf--h3 graf-after--figure"><code
class="markup--code markup--h3-code">-></code> operator returns values out of JSON columns</h3>
<p name="32cf" id="32cf" class="graf graf--p graf-after--h3">Selecting 1 column:</p>
<pre name="288b" id="288b"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT client, <br> data->'title' AS title<br> FROM books;</code></pre>
<p name="6502" id="6502" class="graf graf--p graf-after--pre">Output:</p>
<figure name="79a5" id="79a5" class="graf graf--figure graf-after--p"><img class="graf-image"
data-image-id="0*OIVYOfYcbVh65Mt5" data-width="312" data-height="92"
src="https://cdn-images-1.medium.com/max/800/0*OIVYOfYcbVh65Mt5"></figure>
<p name="c865" id="c865" class="graf graf--p graf-after--figure">Selecting 2 columns:</p>
<pre name="1cb7" id="1cb7"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT client, <br> data->'title' AS title, data->'author' AS author<br> FROM books;</code></pre>
<p name="d745" id="d745" class="graf graf--p graf-after--pre">Output:</p>
<figure name="6852" id="6852" class="graf graf--figure graf-after--p"><img class="graf-image"
data-image-id="0*fEzPkSY8yGexKOk4" data-width="592" data-height="93"
src="https://cdn-images-1.medium.com/max/800/0*fEzPkSY8yGexKOk4"></figure>
<h3 name="d26b" id="d26b" class="graf graf--h3 graf-after--figure"><code
class="markup--code markup--h3-code">-></code> vs <code
class="markup--code markup--h3-code">->></code></h3>
<p name="c1ea" id="c1ea" class="graf graf--p graf-after--h3">The <code
class="markup--code markup--p-code">-></code> operator returns the original JSON type (which might
be an object), whereas <code class="markup--code markup--p-code">->></code> returns text.</p>
<h3 name="505f" id="505f" class="graf graf--h3 graf-after--p">Return NESTED objects</h3>
<p name="94a8" id="94a8" class="graf graf--p graf-after--h3">You can use the <code
class="markup--code markup--p-code">-></code> to return a nested object and thus chain the
operators:</p>
<pre name="953e" id="953e"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT client, <br> data->'author'->'last_name' AS author<br> FROM books;</code></pre>
<p name="7530" id="7530" class="graf graf--p graf-after--pre">Output:</p>
<figure name="46cb" id="46cb" class="graf graf--figure graf-after--p"><img class="graf-image"
data-image-id="0*lwy8bR7igaroMXeb" data-width="185" data-height="89"
src="https://cdn-images-1.medium.com/max/800/0*lwy8bR7igaroMXeb"></figure>
<h3 name="490a" id="490a" class="graf graf--h3 graf-after--figure">Filtering</h3>
<p name="8a46" id="8a46" class="graf graf--p graf-after--h3">Select rows based on a value inside your
JSON:</p>
<pre name="a15b" id="a15b"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT <br> client,<br> data->'title' AS title<br> FROM books<br> WHERE data->'title' = '"Bryan Guner"';</code></pre>
<p name="7f86" id="7f86" class="graf graf--p graf-after--pre">Notice WHERE uses <code
class="markup--code markup--p-code">-></code> so we must compare to JSON <code
class="markup--code markup--p-code">'"Bryan Guner"'</code></p>
<p name="158c" id="158c" class="graf graf--p graf-after--p">Or we could use <code
class="markup--code markup--p-code">->></code> and compare to <code
class="markup--code markup--p-code">'Bryan Guner'</code></p>
<p name="b0a8" id="b0a8" class="graf graf--p graf-after--p">Output:</p>
<figure name="05ad" id="05ad" class="graf graf--figure graf-after--p"><img class="graf-image"
data-image-id="0*poASndLoU71qlXqE" data-width="207" data-height="47"
src="https://cdn-images-1.medium.com/max/800/0*poASndLoU71qlXqE"></figure>
<h3 name="25c6" id="25c6" class="graf graf--h3 graf-after--figure">Nested filtering</h3>
<p name="ea63" id="ea63" class="graf graf--p graf-after--h3">Find rows based on the value of a nested JSON
object:</p>
<pre name="e5e4" id="e5e4"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT <br> client,<br> data->'title' AS title<br> FROM books<br> WHERE data->'author'->>'last_name' = 'Kerouac';</code></pre>
<p name="1673" id="1673" class="graf graf--p graf-after--pre">Output:</p>
<figure name="3c44" id="3c44" class="graf graf--figure graf-after--p"><img class="graf-image"
data-image-id="0*R1kOhDK19ntdUYkq" data-width="212" data-height="52"
src="https://cdn-images-1.medium.com/max/800/0*R1kOhDK19ntdUYkq"></figure>
<h3 name="2b05" id="2b05" class="graf graf--h3 graf-after--figure">A real world example</h3>
<pre name="013d" id="013d"
class="graf graf--pre graf-after--h3"><code class="markup--code markup--pre-code">CREATE TABLE events (<br> name varchar(200),<br> visitor_id varchar(200),<br> properties json,<br> browser json<br>);</code></pre>
<p name="98c5" id="98c5" class="graf graf--p graf-after--pre">We’re going to store events in this table,
like pageviews. Each event has properties, which could be anything (e.g. current page) and also sends
information about the browser (like OS, screen resolution, etc). Both of these are completely free form
and could change over time (as we think of extra stuff to track).</p>
<pre name="88c8" id="88c8"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">INSERT INTO events VALUES (<br> 'pageview', '1',<br> '{ "page": "/" }',<br> '{ "name": "Chrome", "os": "Mac", "resolution": { "x": 1440, "y": 900 } }'<br>);<br>INSERT INTO events VALUES (<br> 'pageview', '2',<br> '{ "page": "/" }',<br> '{ "name": "Firefox", "os": "Windows", "resolution": { "x": 1920, "y": 1200 } }'<br>);<br>INSERT INTO events VALUES (<br> 'pageview', '1',<br> '{ "page": "/account" }',<br> '{ "name": "Chrome", "os": "Mac", "resolution": { "x": 1440, "y": 900 } }'<br>);<br>INSERT INTO events VALUES (<br> 'purchase', '5',<br> '{ "amount": 10 }',<br> '{ "name": "Firefox", "os": "Windows", "resolution": { "x": 1024, "y": 768 } }'<br>);<br>INSERT INTO events VALUES (<br> 'purchase', '15',<br> '{ "amount": 200 }',<br> '{ "name": "Firefox", "os": "Windows", "resolution": { "x": 1280, "y": 800 } }'<br>);<br>INSERT INTO events VALUES (<br> 'purchase', '15',<br> '{ "amount": 500 }',<br> '{ "name": "Firefox", "os": "Windows", "resolution": { "x": 1280, "y": 800 } }'<br>);</code></pre>
<p name="6ed0" id="6ed0" class="graf graf--p graf-after--pre">Now lets select everything:</p>
<pre name="c4b3" id="c4b3"
class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">SELECT * FROM events;</code></pre>
<p name="66cb" id="66cb" class="graf graf--p graf-after--pre">Output:</p>
<figure name="3bed" id="3bed" class="graf graf--figure graf-after--p"><img class="graf-image"
data-image-id="0*ZPHfB4FxjSIlAVxL" data-width="1026" data-height="143"
src="https://cdn-images-1.medium.com/max/800/0*ZPHfB4FxjSIlAVxL"></figure>
<h3 name="e9ca" id="e9ca" class="graf graf--h3 graf-after--figure">JSON operators + PostgreSQL aggregate
functions</h3>
<p name="f07e" id="f07e" class="graf graf--p graf-after--h3">Using the JSON operators, combined with
traditional PostgreSQL aggregate functions, we can pull out whatever we want. You have the full might of
an RDBMS at your disposal.</p>
<ul class="postList">
<li name="4ffd" id="4ffd" class="graf graf--li graf-after--p">Lets see browser usage:</li>
<li name="261c" id="261c" class="graf graf--li graf-after--li"><code
class="markup--code markup--li-code">SELECT browser->>'name' AS browser,
count(browser) FROM events GROUP BY browser->>'name';</code></li>
</ul>
<p name="d3d9" id="d3d9" class="graf graf--p graf-after--li">Output:</p>
<figure name="333d" id="333d" class="graf graf--figure graf-after--p"><img class="graf-image"
data-image-id="0*4lEv2DgUk33FeUgo" data-width="94" data-height="67"
src="https://cdn-images-1.medium.com/max/800/0*4lEv2DgUk33FeUgo"></figure>
<ul class="postList">
<li name="946c" id="946c" class="graf graf--li graf-after--figure">Total revenue per visitor:</li>
</ul>
<p name="5472" id="5472" class="graf graf--p graf-after--li"><code
class="markup--code markup--p-code">SELECT visitor_id, SUM(CAST(properties->>'amount' AS
integer)) AS total FROM events WHERE CAST(properties->>'amount' AS integer) > 0 GROUP
BY visitor_id;</code></p>
<p name="7d27" id="7d27" class="graf graf--p graf-after--p">Output:</p>
<figure name="cbce" id="cbce" class="graf graf--figure graf-after--p"><img class="graf-image"
data-image-id="0*HxOS3CgwXBJ6A2FP" data-width="182" data-height="69"
src="https://cdn-images-1.medium.com/max/800/0*HxOS3CgwXBJ6A2FP"></figure>
<ul class="postList">
<li name="9850" id="9850" class="graf graf--li graf-after--figure">Average screen resolution</li>
<li name="132f" id="132f" class="graf graf--li graf-after--li"><code
class="markup--code markup--li-code">SELECT
AVG(CAST(browser->'resolution'->>'x' AS integer)) AS width,
AVG(CAST(browser->'resolution'->>'y' AS integer)) AS height FROM
events;</code></li>
</ul>
<p name="b5a2" id="b5a2" class="graf graf--p graf-after--li">Output:</p>
<figure name="2c21" id="2c21" class="graf graf--figure graf-after--p"><img class="graf-image"
data-image-id="0*iyv4Iv4Rc8M8mwt1" data-width="305" data-height="54"
src="https://cdn-images-1.medium.com/max/800/0*iyv4Iv4Rc8M8mwt1"></figure>
<h4 name="4640" id="4640" class="graf graf--h4 graf-after--figure">If you found this guide helpful feel
free to checkout my github/gists where I host similar content:</h4>
<p name="1c2f" id="1c2f" class="graf graf--p graf-after--h4"><a href="https://gist.github.com/bgoonz"
data-href="https://gist.github.com/bgoonz" class="markup--anchor markup--p-anchor" rel="noopener"
target="_blank">bgoonz’s gists · GitHub</a></p>
<div name="3585" id="3585" class="graf graf--mixtapeEmbed graf-after--p"><a
href="https://github.com/bgoonz" data-href="https://github.com/bgoonz"
class="markup--anchor markup--mixtapeEmbed-anchor" title="https://github.com/bgoonz"><strong
class="markup--strong markup--mixtapeEmbed-strong">bgoonz — Overview</strong><br><em
class="markup--em markup--mixtapeEmbed-em">Web Developer, Electrical Engineer JavaScript | CSS |
Bootstrap | Python | React | Node.js | Express | Sequelize…</em>github.com</a><a
href="https://github.com/bgoonz" class="js-mixtapeImage mixtapeImage u-ignoreBlock"
data-media-id="6ee74d5200d495ddc7ddad0c92bd6dce" data-thumbnail-img-id="0*Udg3rbeFyslZ9dyl"
style="background-image: url(https://cdn-images-1.medium.com/fit/c/160/160/0*Udg3rbeFyslZ9dyl);"></a>
</div>
<p name="cb1a" id="cb1a" class="graf graf--p graf-after--mixtapeEmbed">Or Checkout my personal Resource
Site:</p>
<div name="4bce" id="4bce" class="graf graf--mixtapeEmbed graf-after--p"><a
href="https://goofy-euclid-1cd736.netlify.app/" data-href="https://goofy-euclid-1cd736.netlify.app/"
class="markup--anchor markup--mixtapeEmbed-anchor"
title="https://goofy-euclid-1cd736.netlify.app/"><strong
class="markup--strong markup--mixtapeEmbed-strong">a/A-Student-Resources</strong><br><em
class="markup--em markup--mixtapeEmbed-em">Edit
description</em>goofy-euclid-1cd736.netlify.app</a><a
href="https://goofy-euclid-1cd736.netlify.app/" class="js-mixtapeImage mixtapeImage u-ignoreBlock"
data-media-id="260adefce95974b3b8f27566d0434b9c" data-thumbnail-img-id="0*kHvsYWw7LFYl0PB_"
style="background-image: url(https://cdn-images-1.medium.com/fit/c/160/160/0*kHvsYWw7LFYl0PB_);"></a>
</div>
<h3 name="9ece" id="9ece" class="graf graf--h3 graf-after--mixtapeEmbed">If you found this guide helpful
feel free to checkout my GitHub/gists where I host similar content:</h3>
<div name="d77e" id="d77e" class="graf graf--mixtapeEmbed graf-after--h3"><a
href="https://gist.github.com/bgoonz" data-href="https://gist.github.com/bgoonz"
class="markup--anchor markup--mixtapeEmbed-anchor" title="https://gist.github.com/bgoonz"><strong
class="markup--strong markup--mixtapeEmbed-strong">bgoonz’s gists</strong><br><em
class="markup--em markup--mixtapeEmbed-em">Instantly share code, notes, and snippets. Web Developer,
Electrical Engineer JavaScript | CSS | Bootstrap | Python |…</em>gist.github.com</a><a
href="https://gist.github.com/bgoonz" class="js-mixtapeImage mixtapeImage u-ignoreBlock"
data-media-id="ab25adbb500306703daab23d08a7739a" data-thumbnail-img-id="0*3O67jrqm3EHjTK2H"
style="background-image: url(https://cdn-images-1.medium.com/fit/c/160/160/0*3O67jrqm3EHjTK2H);"></a>
</div>
<div name="2a2c" id="2a2c" class="graf graf--mixtapeEmbed graf-after--mixtapeEmbed"><a
href="https://github.com/bgoonz" data-href="https://github.com/bgoonz"
class="markup--anchor markup--mixtapeEmbed-anchor" title="https://github.com/bgoonz"><strong
class="markup--strong markup--mixtapeEmbed-strong">bgoonz — Overview</strong><br><em
class="markup--em markup--mixtapeEmbed-em">Web Developer, Electrical Engineer JavaScript | CSS |
Bootstrap | Python | React | Node.js | Express | Sequelize…</em>github.com</a><a
href="https://github.com/bgoonz" class="js-mixtapeImage mixtapeImage u-ignoreBlock"
data-media-id="6ee74d5200d495ddc7ddad0c92bd6dce" data-thumbnail-img-id="0*Udg3rbeFyslZ9dyl"
style="background-image: url(https://cdn-images-1.medium.com/fit/c/160/160/0*Udg3rbeFyslZ9dyl);"></a>
</div>
<h3 name="26c7" id="26c7" class="graf graf--h3 graf-after--mixtapeEmbed">Or Checkout my personal
Resource Site:</h3>
<div name="b88c" id="b88c" class="graf graf--mixtapeEmbed graf-after--h3 graf--trailing"><a
href="https://web-dev-resource-hub.netlify.app/" data-href="https://web-dev-resource-hub.netlify.app/"
class="markup--anchor markup--mixtapeEmbed-anchor"
title="https://web-dev-resource-hub.netlify.app/"><strong
class="markup--strong markup--mixtapeEmbed-strong">Web-Dev-Resource-Hub</strong><br><em
class="markup--em markup--mixtapeEmbed-em">Edit
description</em>web-dev-resource-hub.netlify.app</a><a
href="https://web-dev-resource-hub.netlify.app/"
class="js-mixtapeImage mixtapeImage mixtapeImage--empty u-ignoreBlock"
data-media-id="142b348a1c3b7cab095decda3afd6236"></a></div>
</div>
</div>
</section>
</section>
<footer>
<p>By <a href="https://medium.com/@bryanguner" class="p-author h-card">Bryan Guner</a> on <a
href="https://medium.com/p/718b813d3e31"><time class="dt-published"
datetime="2021-03-05T14:55:13.742Z">March 5, 2021</time></a>.</p>
<p><a href="https://medium.com/@bryanguner/postgresql-cheat-sheet-718b813d3e31" class="p-canonical">Canonical
link</a></p>
<p>Exported from <a href="https://medium.com">Medium</a> on April 3, 2021.</p>
</footer>
</article>
</body>
</html>