PostgreSQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
It is a relational database that is popular.
What are some advantages of learning a relational database?
You can learn other relational database just as fast due to similarities
What is one way to see if PostgreSQL is running?
sudo service postgresql status
What is a database schema?
Collection of tables
What is a table?
tables are relations
What is a row?
data about columns
What is SQL and how is it different from languages like JavaScript?
Structured Query Language and declarative programming language much like HTML and CSS
(You tell it what to do)
How do you retrieve specific columns from a database table?
Use select “columnName”
How do you filter rows based on some specific criteria?
Use where “columnName” operator (=, >, < e.t.c) ‘value’
What are the benefits of formatting your SQL?
Better readability and looks clean
What are four comparison operators that can be used in a where clause?
equal, not equal, greater than, less than (equal to)
How do you limit the number of rows returned in a result set?
Use limit value
How do you retrieve all columns from a database table?
Use select asterisk (*)
How do you control the sort order of a result set?
Use order by “columnName” desc (by default it is ascending)
How do you add a row to a SQL table?
insert into “tableName” (“columnName”, …)
values (‘value’, …)