PostgreSQL Flashcards

1
Q

What is PostgreSQL and what are some alternative relational databases?

A

Relational database

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

very transferrable skill

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

running a status command
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 description of how the data will be laid out, formatted

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

What is a table?

A

the stored data including entries (rows) and all attributes (columns)

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

What is a row?

A

the actual data values for the attributes in the database

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

structured query language, a declarative language

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 “colName”,
“alsoThisCol”
from “tableName”;

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 “colName” = ‘stuff”

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

easier to read longer queries

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

< > = !=

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 with a number

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

How do you retrieve all columns from a database table?

A

select * from “tableName”

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

How do you add a row to a SQL table?

A

insert into

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

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

A

returning *

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

What is a foreign key?

A

A value in one table that’s the same as a value in another table that you can associate

17
Q

How do you join two SQL tables?

A

join “tableName” using (“commonColumn”)

18
Q

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

A