postgresSQL Flashcards

1
Q

What is PostgreSQL and what are some alternative relational databases?

A

powerful open source Relational Database Management System. Some alternative relational databases are (MySQL, SQL Server, and Oracle by Oracle Corporation)

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

if you are storing related data. They can store and modify data in a way that makes data corruption as unlikely as possible. (retrieve and store data quickly)(they are very 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

with the top command

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 and defines how the data in a relational database should be organized

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

What is a table?

A

where data is stored in relations. They are a list of rows each having the same set of attributes

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

What is a row?

A

represents a single implicitly structured data item in a table(set of attributes with information)

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 is the primary way of interacting with relational database. It is a powerful way of retrieving, creating, and manipulating data in a relational database.

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

with the select keyword, double quotes, and comma to separate them

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

with the where clause

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

provides us with the ability to limit the number of rows included in a result set. For readability

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

How do you retrieve all columns from a database table?

A

with an asterisk *

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 an order by clause

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

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

A

with the limit keyword

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

execute the command of insert into, and then values

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

What is a tuple?

A

a list of values

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

What is a tuple?

A

an ordered list of values

17
Q

How do you update rows in a database?

A

with the update key and the where clause

18
Q

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

A

with the “returning” clause

19
Q

How do you update rows in a database?

A

with the “update” key and column name equal the value

20
Q

How do you accidentally delete all rows from a table?

A

if you delete from “the name of the table” and thats alll you put in

21
Q

How do you delete rows from a database table?

A

with the “delete from” keyword

22
Q

What is a foreign key?

A

when a column refers to values in a column from a different table. There is just one column that links the tables together

23
Q

How do you join two SQL tables?

A

with a join clause

24
Q

How do you join two SQL tables?

A

with a “join” clause and the “using” clause. Then have the identifier inside a parenthesis

25
Q

What are some examples of aggregate functions?

A

max( ), avg( ), count( ), min( ), sum( ), every( )

26
Q

What is the purpose of a group by clause?

A

if you want to separate rows into groups and perform aggregate functions on those groups of rows only