postgres Flashcards
What is PostgreSQL and what are some alternative relational databases?
PostgreSQL is a relational database management system, other relational databases are MySQL, SQL Server, Oracle
What are some advantages of learning a relational database?
good fit for storing related data, support good guarantees about data integrity, arguably one of the most widely used kind of database
What is one way to see if PostgreSQL is running?
top command
What is a database schema?
a collection of tables
What is a table?
data stored in relations, a list of rows with information
What is a row?
a line in a table containing related information
What is SQL and how is it different from languages like JavaScript?
primary way of interacting with relational databases, unlike JavaScript it is declarative not imperative where we describe what we want and the programming environment comes up with its own plan for getting those results
How do you retrieve specific columns from a database table?
select “specificColumn”
from “databaseTable”
How do you filter rows based on some specific criteria?
select “specificColumn”
from “databaseTable”
where “x” = “y”
What are the benefits of formatting your SQL?
readability
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?
select “specificColumn”
from “databaseTable”
limit x
How do you retrieve all columns from a database table?
select *
from “databaseTable”
How do you control the sort order of a result set?
select *
order by “x” desc (asc is default)
from “databaseTable”
How do you add a row to a SQL table?
insert into “SQLTableName” (“property”
values (“propertyValue”)