Right tool for the right job. An easy case might be a password database, essentially a flat file database, Excel 2-D type of thing. A more difficult case is a video edit. You've got clips, which might expand in number, you've got recipes or methods for various transitions and combinations, and you've got an overall project view which pulls from these. Whatever we have we'd like it to be ACID compliant. Try to use umlet or some such to do the UML.
7 Database Paradigms (9:52) Fireship, 2020. Seven different ways of looking at data, with suggested applications.
issues univ of utah (19:49) Mark Durham, 2018. Has a great chart.
relational algebra, calculus
Relational Algebra is just a form of logical operators (most are shown below), easy to understand for those who've taken logic courses.
Linguistically, Relational Algebra imparted its first name, "relational", to databases constructed around its principles, ergo "relational databases". In other words, relational databases are databases built around Relational Algebra.
Relational Algebra itself was created by Edgar Codd. His main book on this is The Relational Model for Database Management, and his Turing Award paper on relational algebra (1981) is available online (PDF). The most important skill level to reach is the capacity for fast database normalizing. This takes practice, similar to the logic skill for taking statements, text or otherwise, and symbolizing.
Relational Algebra Lecture 1 (50:21) Database Psu, 2015. Penn State. The first in their amazing free online course. Lecture begins about 19:12.
Relational Algebra Pt 3 lecture (51:18) Database Psu, 2015. The various operators and their uses.
Relational calculus is a way of making queries using relational algebra to get what we want from our queries. It's less atomic than relational algebra.
relational keys (primary, foreign, composite, blank)
Link: postgres constraints ::
Relationals are a bit of a pain. See my later post on how to configure PostgreSQL for local access. Restrictions make searches easier. The main idea is a unique column (Cust ID), can then access a unique row in the next table. In the pic below, the primary is green, the foreign red. A column with a "references constraint" on it is a foreign key.
Primary and foreign keys (2:08) Udacity, 2015. Primary and foreign keys explained. Foreign key is column with references constraint. No lookup table is used, but it might be possible by indexing somehow.
Primary and foreign keys (5:24) Prescott Computer Guy, 2011. This has an intermediate lookup table. He wants every table to have an ID column, to be sure to have a unique value for that table.
Postgres version (5:42) Trent Jones, 2020. Unfortunately uses PgAdmin not DBeaver.
SQL from teaching perspective (10:12) Mike Dane, 2017. Exam configuration
- primary key: Postgres/SQL constraint equivalent - NOTNULL, UNIQUE
- foreign key: Postgres/SQL constraint equivalent - none. Verifies that a column from keyed table always has a value in another table (is linked).
constraints | |
---|---|
PostgreSQL | MySQL |
PRIMARY KEY | PRIMARY KEY |
FOREIGN KEY | FOREIGN KEY |
UNIQUE (column) | UNIQUE |
NOT NULL/NULL (null allowed) | NOT NULL |
CHECK | CHECK |
DEFAULT | DEFAULT |
CREATE INDEX | CREATE INDEX |
EXCLUDE | |
start-up/shutdown (postgresql)
See my other post for how to configure as user. That done, it's a pretty simple....
$ postgres -D '/home/foo/postgres/data'
With the server is up and running, you can open another terminal and run psql commands. If you run as user postgres (see below), you'll have admin authority.
$ psql postgres
If a lot of data has been written, a good exit phrase to make sure all is safely written:
$ psql -c CHECKPOINT && pg_ctl stop -m fast
No comments:
Post a Comment