Two components:
Users cannot directly interact with the server
There has to be many tables to build an app
Grouping of these multiple tables are called a schema
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
MySQL is a relational database management system that lets you store data as tables with rows and columns
PostgreSQL is an object-relational database management system that offers more features than MySQL
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 tablePractice: sqlzoo