LFZ Postgres Quiz Flashcards

1
Q

What is PostgreSQL and what are some alternative relational databases?

A

PostgreSQL is a powerful, free, open source Relational Database Management System (RDBMS). MySQL, SQL Microsoft, 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

They are widely used

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

Check with top, or 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 row?

A

A set of attributes

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

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

A

SQL is a declarative programming language, like css, and HTML

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

How do you retrieve specific columns from a database table?

A

by using the ‘select’ keyword with the ‘from’ keyword

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

How do you filter rows based on some specific criteria?

A

with the ‘where’ keyword

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

What are the benefits of formatting your SQL?

A

readability by humans

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

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

A

=, >,

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

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

A

by using the limit keyword at the end

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

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

A

with the order by key phrase

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

How do you add a row to a SQL table?

A

with the insert statement

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

What is a tuple?

A

list of values that corresponds with the tables.

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

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

A

separating tuples with a comma

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

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

A

with the returning statement with a value of *

17
Q

How do you update rows in a database table?

A

with the update statement

18
Q

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

A

You would change all rows without it

19
Q

How do you accidentally delete all rows from a table?

A

by forgetting the where statement

20
Q

How do you delete rows from a database table?

A

with the delete statement

21
Q

What is a foreign key?

A

A key that links one table to another

22
Q

How do you join two SQL tables?

A

with the join statement and a foreign key

23
Q

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

A

by aliasing them

24
Q

What are some examples of aggregate functions?

A

max, avg, count

25
Q

What is the purpose of a group by clause?

A

to separate rows into groups