PostgresQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
It’s a relational database. Some other relational databases are MySQL, Oracle, and SQLite
Important commands for starting, stopping and checking status for PostgreSQL
Sudo service postgreSQL (start / stop / status)
Is PostgreSQL its own application?
Yes! We just interact with it. No building or debugging —> we send it a request and it sends a response.
What is pgweb?
Not our code —> just code somebody else wrote to help us visualize our database.
What are some advantages of learning a relational database?
It’s used literally everywhere. It also allows you to store your data somewhere secure.
What is one way to see if PostgreSQL is running?
Sudo service postgresql status
What is a database schema?
A collection of tables — the design of a database —> like a blueprint
What is SQL and how is it different from languages like JavaScript?
It’s the primary way of interacting with relational databases —> a declarative programming language —> programmers describe the results they want the the end gets the result
How do you retrieve specific columns from a database table?
Use a select statement formatted as…
select “desired-column”,
“another-column”
from “table-name”;
How do you filter rows based on some specific criteria?
Use a where clause formatted as…
where “column-name” = ‘text-to-query’;
If you are adding a number, bool, etc, should you keep the quotes?
Nope — remove them!
What are the benefits of formatting your SQL?
It makes it easier to read, understand, and debug.
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 x(integer);
How do you retrieve all columns from a database table?
Use a select statement formatted as…
select *
from “table-name”;