PostgreSQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
PostgreSQL is a powerful, free, open source Relational Database Management System (RDBMS).
Other popular relational databases include MySQL (also free), SQL Server by Microsoft, and Oracle by Oracle Corporation.
What are some advantages of learning a relational database?
they can be modeled well, data corruption is very unlikely, and they are widely used
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. It defines how data 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?
collection of data for a single item
What is SQL and how is it different from languages like JavaScript?
SQL is different! SQL is a declarative programming language. In declarative languages, programmers describe the results they want and the programming environment comes up with its own plan for getting those results.
JavaScript is imperative
How do you retrieve specific columns from a database table?
select “name”
How do you filter rows based on some specific criteria?
where “category” = ‘cleaning’;
What are the benefits of formatting your SQL?
makes it easier to read
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?
limit 1;
at end of code
How do you retrieve all columns from a database table?
Select*
How do you control the sort order of a result set?
order by price
DESC if you want descending instead of ascending
How do you add a row to a SQL table?
insert into “products” (“name”, “description”, “price”, “category”)
values (‘Ostrich Pillow’, ‘Feel comfy and cozy!’, 99, ‘self care’);