postgresSQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
powerful open source Relational Database Management System. Some alternative relational databases are (MySQL, SQL Server, and Oracle by Oracle Corporation)
What are some advantages of learning a relational database?
if you are storing related data. They can store and modify data in a way that makes data corruption as unlikely as possible. (retrieve and store data quickly)(they are very widely used)
What is one way to see if PostgreSQL is running?
with the top command
What is a database schema?
a collection of tables and defines how the data in a relational database should be organized
What is a table?
where data is stored in relations. They are a list of rows each having the same set of attributes
What is a row?
represents a single implicitly structured data item in a table(set of attributes with information)
What is SQL and how is it different from languages like JavaScript?
Structured Query Language is the primary way of interacting with relational database. It is a powerful way of retrieving, creating, and manipulating data in a relational database.
How do you retrieve specific columns from a database table?
with the select keyword, double quotes, and comma to separate them
How do you filter rows based on some specific criteria?
with the where clause
What are the benefits of formatting your SQL?
provides us with the ability to limit the number of rows included in a result set. For readability
How do you retrieve all columns from a database table?
with an asterisk *
How do you control the sort order of a result set?
with an order by clause
How do you limit the number of rows returned in a result set?
with the limit keyword
How do you add a row to a SQL table?
execute the command of insert into, and then values
What is a tuple?
a list of values
What is a tuple?
an ordered list of values
How do you update rows in a database?
with the update key and the where clause
How do you get back the row being inserted into a table without a separate select statement?
with the “returning” clause
How do you update rows in a database?
with the “update” key and column name equal the value
How do you accidentally delete all rows from a table?
if you delete from “the name of the table” and thats alll you put in
How do you delete rows from a database table?
with the “delete from” keyword
What is a foreign key?
when a column refers to values in a column from a different table. There is just one column that links the tables together
How do you join two SQL tables?
with a join clause
How do you join two SQL tables?
with a “join” clause and the “using” clause. Then have the identifier inside a parenthesis
What are some examples of aggregate functions?
max( ), avg( ), count( ), min( ), sum( ), every( )
What is the purpose of a group by clause?
if you want to separate rows into groups and perform aggregate functions on those groups of rows only