PostgreSQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
open source object-relational database management system; mySQL, Oracle, Microsoft SQL server
What are some advantages of learning a relational database?
Relational databases are arguably the most widely used kind of database. Many web developers work with a relational database at least a little bit during their career
What is one way to see if PostgreSQL is running?
command sudo service postgresql status
What is a database schema?
a collection of tables that defines how the data in a relational database should be organized
What is a table?
a list of rows each having the same set of attributes;a database table is sort of like a spreadsheet where each row is a record in that spreadsheet
What is a row?
single structured data item in a table
What is SQL and how is it different from languages like JavaScript?
primary way of interacting with relational databases. It is a powerful way of retrieving, creating, and manipulating data in a relational database; JavaScript is imperative and SQL is declarative
How do you retrieve specific columns from a database table?
select “columnName”
from “tableName”;
How do you filter rows based on some specific criteria?
where “columnName” = ‘specific description’
What are the benefits of formatting your SQL?
consistent style helps with 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 number; limit clause always comes last
How do you retrieve all columns from a database table?
select *
from “tableName”
How do you control the sort order of a result set?
order by clause ; default it ascending order; if specified can use descending order; order by “whatever” desc
How do you add a row to a SQL table?
insert into “tableName”(“columnName”)
values (‘columnValue’);