Two components to a relational Database:
Client
(e.g. pgAdminGUI, Psql CLI)Server
(e.g. PSQL Server)Users cannot directly interact with the database server.
There has to be many tables to build an app.
Grouping of these multiple tables
are called a schema
.
schemas
, they are grouped into a database
.A machine can have many databases running, grouping of these databases is called cluster (database server)
We use language called SQL to send instruction as a client to server
The structure of a SQL query is therefore reverse of the DB hierarchy
db
, then schema
, then the table
(largest to smallest)pgAmin
Scope
is a pre-built filter in the modelScopes
are good because it is more declarative than chaining more methods
t.references
in Rails migrationt.timestamps
adds time stamp columns to the table