PostgreSQL Flashcards
Why do we use databases in Web development?
What is PostgreSQL and what are some alternative relational databases?
What are some advantages of learning a relational database?
What is one way to see if PostgreSQL is running?
What is a database schema?
A collection of tables is called a schema. A schema defines how the data in a relational database should be organized. It dictates how the table will be set up and how it will look.
What is a table?
A table is what relational databases store data in. They are also known as relations, but are more commonly referred to as tables.
What is a row?
A row is all the information about one entry or id of the table.
What is an attribute and what other names are used to describe them?
An attribute is something related to a row. Other names used to describe them are column, property, key, characteristic, etc.
What is SQL and how is it different from languages like JavaScript?
Structured Query Language (SQL) is the primary way of interacting with relational databases and is a powerful way of retrieving, creating, and manipulating data in a relational database. It’s different from languages like JavaScript because it is a declarative programming language while languages like JavaScript are imperative programming languages.
How do you retrieve specific columns from a database table?
You must “select” the columns/properties/keys in a comma separated list.
select “column”,
“property”,
“key”
How do you filter rows based on some specific criteria?
After “select”ing “from” a table, use “where” followed by the criteria. The criteria will be in double quotes “ “ while the criteria value will be in single quotes ‘ ‘ if it is a string, while things like numbers and booleans will not be in quotes at all.
What are the benefits of formatting your SQL?
Formatted SQL makes code look more consistent and therefore increases readability.
What are four comparison operators that can be used in a where clause?
=, !=, <, and >.
How do you limit the number of rows returned in a result set?
At the end of a “select” statement, use “limit” followed by the number of rows you want returned. The number should not be in quotes.
How do you retrieve all columns from a database table?
By using “select” with the universal operator *.