PostgreSQL Flashcards

1
Q

What is PostgreSQL and what are some alternative relational databases?

A

MySQL, SQL server, and Oracle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are some advantages of learning a relational database?

A

categorizing data, accuracy, ease of use, collaboration, security.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is one way to see if PostgreSQL is running?

A

sudo service postgresql status

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a database schema?

A

a collection of tables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a table?

A

objects that contain all data in a database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a row?

A

a single group of related content within a table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is SQL and how is it different from languages like JavaScript?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you retrieve specific columns from a database table?

A

select “column name”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you filter rows based on some specific criteria?

A

where “column name” = ‘specific name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the benefits of formatting your SQL?

A

readability and consistent style.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are four comparison operators that can be used in a where clause?

A

=, <, >, or

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you limit the number of rows returned in a result set?

A

limit number;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you retrieve all column from a database table?

A

select *

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you control the sort order of a result set?

A

desc = descending or asc = ascending

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you add a row to a SQL table?

A

insert statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a tuple?

A

internal representation of a row in a table in PostGreSQL

17
Q

How do you add multiple rows to a Sql table at once?

A

select property=’string’ property=’string’

18
Q

How do you get back the row being inserted into a table without a separate select statement?

A

returning *;

19
Q

How do you update rows in a database table?

A

insert into

20
Q

Why is it important to include a where clause in your update statements?

A

So you don’t update everything.

21
Q

How do you delete rows from a database table?

A

delete command

22
Q

How do you accidentally delete all rows from a table?

A

if you don’t include a where clause.

23
Q

What is a foreign key?

A

a column in a table that points to a primary key or unique key column in the same or another table.

24
Q

How do you join two SQL tables?

A

using the join keyword.

25
Q

How do you temporarily rename columns or tables in a SQL statement?

A

as

26
Q

What are some examples of aggregate functions?

A

sum(), avg(), count()

27
Q

What is the purpose of a group by clause?

A

group two tables together.