PostgreSQL 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). Some other relational databases are MySQL or 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

It works well with storing related data, and almost all of them use the same language so it isn’t hard to switch from one relational database to another.

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 that correspond to each other

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

What is a table?

A

a collection of data that is related with each other

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

What is a row?

A

collection of values that correspond to the attributes of that 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 a powerful way of retrieving, creating, and manipulating data in a relational database. It is a declarative language where as JavaScript is a imperative 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

By including them in the select statement

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

using the where statement followed by the row name and then the criteria

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 readability

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 retrieve all columns from a database table?

A

by including an asterisk in the select statement

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

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

A

using an order by statement

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

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

A

using a limit statement

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

by using insert into, the table name, then the column names you want to edit. Then on the following line use a values clause and add the value in order to the listed column names above

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

What is a tuple?

A

a list of values

17
Q

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

A

list multiple tuples

18
Q

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

A

by using returning followed by an asterisk

19
Q

How do you update rows in a database table?

A

Using the update clause followed by the table name, then use the set clause and set a value or values to one or more column names. then display exactly which row you want to change by using the where clause.

20
Q

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

A

So it doesn’t effect the whole column of values

21
Q

How do you delete rows from a database table?

A

By using the delete from clause followed by the table name. using the where clause after will let you specify what item or items you want to delete.

22
Q

How do you accidentally delete all rows from a table?

A

when you only include the delete from line followed by a table name

23
Q

What is a foreign key?

A

A key or id that relates to another tables contents

24
Q

How do you join two SQL tables?

A

using the from and join clause

25
Q

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

A

use the as keyword

26
Q

What is the purpose of a group by clause?

A

to apply the aggregate functions to a clump of rows