PostgreSQL Flashcards
[Postgres Intro]
What is PostgreSQL and what are some alternative relational databases?
PostgreSQL - relational database
MySQL, SQL Server by Microsoft, Oracle
[Postgres Intro]
What are some advantages of learning a relational database?
They are very common, knowing one will translate well to others
[Postgres Intro]
What is one way to see if PostgreSQL is running?
$ sudo service postgresql status
with service, they won’t take up your terminal (they run in the background)
What does SQL mean?
Structured Query Language
[Postgres Database]
What is a database schema?
A collection of tables which define how the data in a database should be organized
[Postgres Database]
What is a table?
Rows with the same set of attributes
[Postgres Database]
What is a row?
One entry with one value of the data
[Postgres Database]
What command is used to create a database?
What command is used to delete a database?
$ createdb databasename
$ dropdb databasename
[SQL Select]
What is SQL and how is it different from languages like JavaScript?
SQL is a declarative language where JavaScript is imperative language.
[SQL Select]
How do you retrieve specific columns from a database table?
select (keyword) “col title”
from (clause) “table name”
[SQL Select]
How do you filter rows based on some specific criteria?
where (clause) “category” comparison operator ‘value’
which returns true or false
[SQL Select]
What are the benefits of formatting your SQL?
Makes it easier to read the information
[SQL Select]
What are four comparison operators that can be used in a where clause?
=, !=, <, >
[SQL Select]
How do you limit the number of rows returned in a result set?
limit num;
[SQL Select]
How do you retrieve all columns from a database table?
select (keyword) *