postsqul Flashcards

1
Q

What is PostgreSQL and what are some alternative relational databases?

A

PostgreSQL is a relational database system. other alternatives are MySQL, SQL Server by Microsoft, 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

be able to make logical connections and make tables

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

by using the 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

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

A table is an arrangement of information or data, typically in rows and columns

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

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

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

by using 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

it makes it easier to catch mistakes and read

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

equal, less than and greater than, and not equal

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

use the limit keyword

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 using the astric selector

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

by using the order by

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

by using the insert statement

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

What is a tuple?

A

list of values

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

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

A

by inputting values then use comma to input another

17
Q

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

A

use the returning keyword

18
Q

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

A

by using the update keyword

19
Q

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

A

to specify what row we are updating

20
Q

How do you delete rows from a database table?

A

by using the delete keyword

21
Q

How do you accidentally delete all rows from a table?

A

by not specifying what to delete

22
Q

What is a foreign key?

A

its a key that references another table

23
Q

How do you join two SQL tables?

A

use the join keyword then the key that both tables share

24
Q

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

A

youse the as keyword