PostgreSQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
a relational database management system (RDBMS), MySQL, SQLite, SQL microsoft, Oracle
What are some advantages of learning a relational database?
easy to reject “bad” data (half written). Easy to store and modify data in a way that makes data corruption as unlikely as possible, widely use
What is one way to see if PostgreSQL is running?
sudo service postgresql status, TOP command in terminal.
What is a database schema?
collection of tables, 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
What is a row?
data to fill each attributes
What is SQL and how is it different from languages like JavaScript?
SQL is a declarative programming language -> programmers describe the results they want and the programming environment comes up with its own plan for getting those results.
JavaScript is an imperative programming language -> you tell programming environment what to do and how to do it.
How do you retrieve specific columns from a database table?
select “column1”, “column2”, … from
How do you filter rows based on some specific criteria?
where “column” = ‘something’
What are the benefits of formatting your SQL?
easier to read top to bottom than left to right
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 * from database_table
How do you control the sort order of a result set?
sort by desc
How do you add a row to a SQL table?
insert into “database_name” (“columnName”, …)
value (‘value1’, …), (‘value##’, …), …