SQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
PostgreSQL is a powerful, free, open source Relational Database Management System
Linter, NexusDB, Paradox
What are some advantages of learning a relational database?
Easy Access to Data, Simple Model, Data Accuracy, Flexibility
What is one way to see if PostgreSQL is running?
using the top command
What is a database schema?
A collection of tables
A schema defines how the data in a relational database should be organized
What is a table?
Relational databases store data in relations, commonly referred to as tables
A table is a list of rows each having the same set of attributes
What is a row?
a record of data
What is SQL and how is it different from languages like JavaScript?
SQL is a declarative programming language
you tell the JavaScript what to do and how to do it. in SQL 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?
select and from
How do you filter rows based on some specific criteria?
where
What are the benefits of formatting your SQL?
consistent style and readability.
What are four comparison operators that can be used in a where clause?
, =, and !=
How do you limit the number of rows returned in a result set?
limit
How do you retrieve all columns from a database table?
*
How do you control the sort order of a result set?
order by
How do you add a row to a SQL table?
insert into “table name” ()
value ()
What is a tuple?
a list of values
How do you add multiple rows to a SQL table at once?
specifying more than one tuple of values, separated by commas.
How do you get back the row being inserted into a table without a separate select statement?
returning *
How do you delete rows from a database table?
delete from “table name”
How do you accidentally delete all rows from a table?
if you just target the tables name
How do you update rows in a database table?
update “table name”
set “row name” = value
Why is it important to include a where clause in your update statements?
it would update every row in the table
What is a foreign key?
a column or set of columns that allow us to establish a referential link between the data in two tables
How do you join two SQL tables?
join “table name” using (“Id”);