postsqul Flashcards
What is PostgreSQL and what are some alternative relational databases?
PostgreSQL is a relational database system. other alternatives are MySQL, SQL Server by Microsoft, and oracle by Oracle Corporation.
What are some advantages of learning a relational database?
be able to make logical connections and make tables
What is one way to see if PostgreSQL is running?
by using the command sudo service PostgreSQL status
What is a database schema?
collection of tables
What is a table?
A table is an arrangement of information or data, typically in rows and columns
What is a row?
represents a single, implicitly structured data item in a table
How do you retrieve specific columns from a database table?
by using the select keyword
How do you filter rows based on some specific criteria?
by using the where keyword
What are the benefits of formatting your SQL?
it makes it easier to catch mistakes and read
What are four comparison operators that can be used in a where clause?
equal, less than and greater than, and not equal
How do you limit the number of rows returned in a result set?
use the limit keyword
How do you retrieve all columns from a database table?
by using the astric selector
How do you control the sort order of a result set?
by using the order by
How do you add a row to a SQL table?
by using the insert statement
What is a tuple?
list of values
How do you add multiple rows to a SQL table at once?
by inputting values then use comma to input another
How do you get back the row being inserted into a table without a separate select statement?
use the returning keyword
How do you get back the row being inserted into a table without a separate select statement?
by using the update keyword
Why is it important to include a where clause in your update statements?
to specify what row we are updating
How do you delete rows from a database table?
by using the delete keyword
How do you accidentally delete all rows from a table?
by not specifying what to delete
What is a foreign key?
its a key that references another table
How do you join two SQL tables?
use the join keyword then the key that both tables share
How do you temporarily rename columns or tables in a SQL statement?
youse the as keyword