PostgresSQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
MySQL, SQLite & MariaDB
What are some advantages of learning a relational database?
Relational databases are arguably the most widely used kind of database. SQLite is an embedded relational database that is deployed in a staggeringly high number of devices and applications
What is one way to see if PostgreSQL is running?
sudo service postgresql status
What is a database schema?
a
What is a table?
list of row with the same attribute
What is a row?
set of
What is SQL and how is it different from languages like JavaScript?
SQL is declarerity programming language
How do you retrieve specific columns from a database table?
a
How do you filter rows based on some specific criteria?
where
What are the benefits of formatting your SQL?
a
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 clous
How do you retrieve all columns from a database table?
select *
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 “content” values ‘value’
What is a tuple?
a list of values is referred to as a tuple.
How do you add multiple rows to a SQL table at once?
insert into “products” (“name”, “description”, “price”, “category”)
values (‘Ostrich Pillow’, ‘Feel comfy and cozy!’, 99, ‘self care’),
(‘Tater Mitts’, ‘Scrub some taters!’, 6, ‘cooking’)
How do you get back the row being inserted into a table without a separate select statement?
returing keyword
How do you update rows in a database table?
update tablename set “attributename”=’value’ where “attribute”=”value”
Why is it important to include a where clause in your update statements?
or else it will delete whole table
How do you delete rows from a database table?
DELETE FROM table_name WHERE condition;
How do you accidentally delete all rows from a table?
delete from “tablename”;
What is a foreign key?
share attribute between 2 tables
How do you join two SQL tables?
join “tablename” using “columnname”
How do you temporarily rename columns or tables in a SQL statement?
using as keyword
What are the three states a Promise can be in?
pending: initial state, neither fulfilled nor rejected.
fulfilled: meaning that the operation was completed successfully.
rejected: meaning that the operation failed.
How do you handle the fulfillment of a Promise?
promise.then()
How do you handle the rejection of a Promise?
promise.catch()