PostgreSQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
Relational database system.
SQLite, MySQL, Oracle, SQL Azure, Teradata
What are some advantages of learning a relational database?
Relational databases are commonly referred to as “SQL databases” because you usually do work with them using some variation of the SQL language.
If you are storing related data, then a relational database is probably a good first choice. A quality of many relational databases is that they support good guarantees about data integrity. They can store and modify data in a way that makes data corruption as unlikely as possible.
What is one way to see if PostgreSQL is running?
sudo service postgresql status
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.
What is a table?
A table is a list of rows each having the same set of attributes.
What is a row?
You might visualize a database table as a sort of spreadsheet where each row is a record in that spreadsheet.
What is SQL and how is it different from languages like JavaScript?
You may be familiar with imperative programming languages such as JavaScript, where you basically tell the JavaScript runtime what to do and how to do it.
QL is a declarative programming language. In declarative languages, programmers describe the results they want.
How do you retrieve specific columns from a database table?
select “column name”
from “table”
How do you filter rows based on some specific criteria?
where “filter topic” = ‘category’
What are the benefits of formatting your SQL?
SQL does not have to be indented, but you should do it anyway for consistent style and therefore 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?
limit #;
How do you retrieve all columns from a database table?
select *
How do you control the sort order of a result set?
desc
(The default sort order of the results is ascending order)
How do you add a row to a SQL table?
insert into “table” (‘column name’)
values (‘value’)