PostgreSQL Flashcards
(27 cards)
What is PostgreSQL and what are some alternative relational databases?
MySQL, SQL server, and Oracle.
What are some advantages of learning a relational database?
categorizing data, accuracy, ease of use, collaboration, security.
What is one way to see if PostgreSQL is running?
sudo service postgresql status
What is a database schema?
a collection of tables.
What is a table?
objects that contain all data in a database.
What is a row?
a single group of related content within a table.
What is SQL and how is it different from languages like JavaScript?
SQL is where you learn how to work with a database. JavaScript is a full on programming language that is later leveraged to help you write server-sided code.
How do you retrieve specific columns from a database table?
select “column name”
How do you filter rows based on some specific criteria?
where “column name” = ‘specific name
What are the benefits of formatting your SQL?
readability and consistent style.
What are four comparison operators that can be used in a where clause?
=, <, >, or
How do you limit the number of rows returned in a result set?
limit number;
How do you retrieve all column from a database table?
select *
How do you control the sort order of a result set?
desc = descending or asc = ascending
How do you add a row to a SQL table?
insert statement
What is a tuple?
internal representation of a row in a table in PostGreSQL
How do you add multiple rows to a Sql table at once?
select property=’string’ property=’string’
How do you get back the row being inserted into a table without a separate select statement?
returning *;
How do you update rows in a database table?
insert into
Why is it important to include a where clause in your update statements?
So you don’t update everything.
How do you delete rows from a database table?
delete command
How do you accidentally delete all rows from a table?
if you don’t include a where clause.
What is a foreign key?
a column in a table that points to a primary key or unique key column in the same or another table.
How do you join two SQL tables?
using the join keyword.