Databases Flashcards
other databases
“document databases”, “non-relational databases”, or “NoSQL databases”
RDBMS
Relational Database Management System
a software application that you run that your programs can connect to that they can store, modify, and retrieve data
PostgreSQL
It is an “open-source” RDBMS which means that you can go read the source code for it, copy it, modify it, and make your own specialized version of an RDBMS.
SQL was implemented as its core query language
PostgreSQL is software
You install PostgreSQL onto a computer. It then runs as a “service”, that is, a program that runs in the background that should not stop until the machine does. You will install it on your computer. It will quietly run in the background, eagerly awaiting for you to connect to it and interact with it from the command line, from a GUI tool, or from your application.
When you do connect with it, you will interact with it through a small set of its own commands and SQL.
database (or more properly relational database)
a collection of structured data that the RDBMS manages for you. A single running RDBMS can have hundreds of databases in it that it manages.
“database server”
That is the computer on which the RDBMS is running.
SQL
Structured Query Language
declarative programming language
most SQL works on sets of records
The “User” in PostgreSQL
a database entity that represents a person or system that will connect to the RDBMS and access data from one or more databases.
table
a “logical” structure that defines how data is stored and contains that data that meets the definition. Most people think about tables like spreadsheets that have a specific number of columns and rows that contain the data.
Schemas
allow use to easily visualize database tables and their relationships to one another, so that we can identify areas that need clarity, refinement, or redesign.
RDD
Relational Database Design
In an RDD, the data are organized into tables and all types of data access are carried out via controlled transactions.”
There are four generally-agreed-upon stages of Relational Database Design:
Define the purpose/entities of the relational DB. Identify primary keys. Establish table relationships. one-to-one one-to-many many-to-many Apply normalization rules.
Object Relational Mapping(ORM)
An ORM allows a JavaScript programmer to fetch and store data in a SQL database using JavaScript functions instead of writing SQL code.
a library that allows you to access data stored in a SQL database through object-oriented, non-SQL code (such as JavaScript). You will write object-oriented code that accesses data stored in a relational SQL database like Postgres. The ORM is the mapping that will “translate” your object-oriented code into SQL code that the database can run. The ORM will automatically generate SQL code for common tasks like fetching and storing data.
migration
“moves” the database from an old schema to a new schema.
Sequelize also lets you write JavaScript code that creates, modifies, or drops SQL tables. The JavaScript code that does this is called a migration.
CRUD
Save a new cat to the database by creating a new row in the Cats table,
We can read previously stored cat data by fetching a row (or multiple rows) out of the Cats table,
We can update some of the column values for a pre-existing cat by modifying a row in the Cats table,
We can delete (destroy) the data for a cat by removing a row in the Cats table.
Use Sequelize to create new records in a table,
Use Sequelize to read/fetch existing records by primary key,
Use Sequelize to update existing records with new attribute values,
Use Sequelize to delete records from a table.
validation.
validation is code that makes sure that data is valid.
Sequelize lets us write JavaScript code that will check that these data requirements are satisfied before saving a record to the database