Databases Flashcards
What is PostgreSQL and what are some alternative relational databases?
An open-source relational database.
mySql / Oracle / SQL Server
What are some advantages of learning a relational database?
So much work of a developer involves things that have relationships so RDB is a perfect tool
What is one way to see if PostgreSQL is running?
sudo service postgresql status
What is a database schema?
A collection of tables
What is a table?
A table holds records that have the same attributes
What is a row?
A single record
What is SQL and how is it different from languages like JavaScript?
Structured Query language, used to interact with a database.
It’s declarative, you tell it what to do but not how to do it as opposed to JS which is imperative, you tell it how to do things
How do you retrieve specific columns from a database table?
select “col1”, “col2”
from “table”
How do you filter rows based on some specific criteria?
where “col” = something
What are four comparison operators that can be used in a where clause?
= / != / < / >
How do you limit the number of rows returned in a result set?
limit num;
How do you retrieve all columns from a database table?
select *
How do you control the sort order of a result set?
order by “col”, ascending default or desc
How do you add a row to a SQL table?
insert into “table” (“col1”, “col2”)
values (“val1”, “val2”)
What is a tuple?
list of values