Postgres Flashcards
What is PostgreSQL and what are some alternative relational databases?
MongoDB (NoSQL), MySQL, Microsoft SQL Server, Oracle, IBM
What are some advantages of learning a relational databases?
Structures, relationships, data integrity, simple, normalization
What is one way to see if PostgreSQL is running?
top, status
What is a database schema?
How data should be organized
What is a table?
Relations
What is a row?
data
What is SQL and how is it different from languages like JavaScript?
Structured Query Language, declarative language, describing the results they want
How do you retrieve specific columns from a database table?
select column
How do you filter rows based on some specific criteria?
where
What are the benefits of formatting your SQL?
Readability
What are four comparison operators that can be used in a where clause?
less than
greater than
equal
not equal
How do you limit the number of rows returned in a result set?
limit
How do you retrieve all columns from a database table?
*
How do you control the sort order of a result set?
order by … asc/desc
How do you add a row to SQL table?
INSERT INTO
What is a tuple?
List of values
How do you add multiple rows to a SQL table at once?
, delimit values
How do you get back the row being inserted into a table without a separate select statement?
returning *
How do you update rows in a database table?
UPDATE
SET
Why is it important to include a where clause in your update statemetns?
You will update everything
How do you delete rows from a database table?
DELETE FROM
How do you accidently delete all rows from a table?
DELETE FROM TABLE
What is a foreign key?
Refer to another row of data from another table
How do you join two SQL tables?
join using
How do you temporarily rename columns or tables in a SQL statement?
alias using AS
What are some examples of aggregate functions?
min, sum, avg, count
What is the purpose of a group by clause?
To group by a similar value
What are the three states a promise can be in?
fulfilled, pending, rejected
How do you handle the fulfillment of a promise?
then()
How do you handle the rejection of a promise?
catch