PostgreSQL/SQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
Open source relational database server
Other databases: SQLite, SQL Server, Oracle SQL
What are some advantages of learning a relational database?
Great if you are storing related data. Less likelihood of data corruption. Most importantly: you will use it as a developer.
What is one way to see if PostgreSQL is running?
sudo service postgresql status
What is a database schema?
Dictates how data should be organized
What is a table?
Organized rows that have the same set of attributes. Overall, a place where data can be stored
What is a row?
One record in a table
What is SQL and how is it different from languages like JavaScript?
Its a declarative language meaning you tell what you want and the language will interpret it. On the other hand, JS is imperative meaning you have to tell it exactly what you want it to do.
How do you retrieve specific columns from a database table?
select “column”
from “table”;
How do you filter rows based on some specific criteria?
where clause “column” = ‘data’
What are the benefits of formatting your SQL?
SQL can get very complex. Structuring it will make it easier to read.
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 clause
How do you retrieve all columns from a database table?
*
How do you control the sort order of a result set?
order by “column” desc/asc
How do you add a row to a SQL table?
insert into “table” (“column”, “column”)