Postgres Flashcards
What is PostgreSQL and what are some alternative relational databases?
a powerful, free, open source Relational Database Management System (RDBMS) MySQL, SQL Server, Oracle
What are some advantages of learning a relational database?
they support good guarantees about data integrity, 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, or top
What is a database schema?
collection of tables
Defines how the data in a relational database should be organized
What is a table?
relations - where relational databases are store data in a set of rows
What is a row?
Having the same set of attributes
What is SQL and how is it different from languages like JavaScript?
Structured Query Language (SQL) - primary way of interacting with relational databases - a declarative programming language
How do you retrieve specific columns from a database table?
Querying a database typically takes the form of a select statement.
select “name”,
“price”
from “products”;
How do you filter rows based on some specific criteria?
where “category” = ‘cleaning’;
What are the benefits of formatting your SQL?
Consistent style and 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?
order by “columnName” asc/desc
How do you add a row to a SQL table?
insert statement is a means of adding rows to a table.