DBMS Restart Flashcards
Which way do joins nest
left to right
Name a data generating function and explain
generate_series(), returns a number of rows aka table functions. Can use FROM on this too
WITH ORDINALITY
meaning that it will be output as a sequence numbering its values.
ex. SELECT * FROM generate_series() with ordinality.
Type Casting in Postgres
CAST() or use :: operator
ex. CAST(sal as int)
Bit Strings
Sequences of 0s and 1s. Bit String Data Types in Postgres are:
- bit(n)
- bit varying(n)
bit(n)
With string length n being fixed at definition
bit_varying(n)
String length n is the maximum value supported
Bit String Operators supported
Concat, Bitwise And, Bitwise Or, ~, #, Bitwise shifts
CREATE SEQUENCE
creates a sequence in columns in order
ENUMerated types
Define our own types ex. ENUM(‘red’,’blue’,’green’)
Case sensitive + Order is important
BLOB
Binary Large Object, Basic binary Datatype
ByteA supports binary strings in bits.
This can be a file like a WAV, PNG, EXE etc.
Basically just a file constructed of binary
TOAST
The Oversized attribute storage techniques supported by pgsql automatically stores values bigger than a single DB page into a secondary storage region. Limits size of any column to 1gb.
What risk comes with reading direct from server process
Security risks as scripts assume user is a superuser.
Array[] Type Constructor
Popular in GUI elements, computations and visualizations. Support SQL must define, update, manage and query tables with arrays.
How can you map arrays to tuples
using the ‘unnest(ARRAY[])’ command.
You can also map tuples to arrays.