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?
Relational databases are arguably the most widely used kind of database. Many times when developers create a full stack developer, they are using a relational database.
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. A schema defines how the data in a relational database should be organized.
What is a table?
A table is data that is in a list of rows where rows each have the same set of attributes.
What is a row
A single instance of record in that table
What is SQL and how is it different from languages like JavaScript?
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.
How do you retrieve specific columns from a database table?
Use the select
keyword followed by the name of the column.
How do you filter rows based on some specific criteria?
Use the select
and where
clause; expression that evaulates to true or false
What are the benefits of formatting your SQL?
For 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?
Keyword limit
followed by a number for the number of rows
How do you retrieve all columns from a database table?
Select *
How do you control the sort order of a result set?
Keyword order by
column name ___ (default is ascending) and if want descending put desc
How do you add a row to a SQL table?
insert into “name of table to insert to” (“column names separated by commas”)
values (’text values wrapped in single quotes’, number values with literal numbers);