LFZ Postgres Quiz Flashcards
What is PostgreSQL and what are some alternative relational databases?
PostgreSQL is a powerful, free, open source Relational Database Management System (RDBMS). MySQL, SQL Microsoft, Oracle
What are some advantages of learning a relational database?
They are widely used
What is one way to see if PostgreSQL is running?
Check with top, or sudo service postgresql status
What is a database schema?
A collection of tables
What is a row?
A set of attributes
What is SQL and how is it different from languages like JavaScript?
SQL is a declarative programming language, like css, and HTML
How do you retrieve specific columns from a database table?
by using the ‘select’ keyword with the ‘from’ keyword
How do you filter rows based on some specific criteria?
with the ‘where’ keyword
What are the benefits of formatting your SQL?
readability by humans
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?
by using the limit keyword at the end
How do you control the sort order of a result set?
with the order by key phrase
How do you add a row to a SQL table?
with the insert statement
What is a tuple?
list of values that corresponds with the tables.
How do you add multiple rows to a SQL table at once?
separating tuples with a comma
How do you get back the row being inserted into a table without a separate select statement?
with the returning statement with a value of *
How do you update rows in a database table?
with the update statement
Why is it important to include a where clause in your update statements?
You would change all rows without it
How do you accidentally delete all rows from a table?
by forgetting the where statement
How do you delete rows from a database table?
with the delete statement
What is a foreign key?
A key that links one table to another
How do you join two SQL tables?
with the join statement and a foreign key
How do you temporarily rename columns or tables in a SQL statement?
by aliasing them
What are some examples of aggregate functions?
max, avg, count
What is the purpose of a group by clause?
to separate rows into groups