database 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.And knowing the SQL language is a very portable skill given that there are so many relational databases driven by almost the same language.

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

is the set of attributes

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 declarative programming language. In declarative languages, programmers describe the results they want and the programming environment comes up with its own plan for getting those results

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

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

The * asterisk is not in quotes

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 and order by clause
The order by clause comes after the from clause.
The order by clause is followed by a column name in “ double quotes.

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 limit clause
The limit clause comes last.
The limit clause includes a literal integer number with no quotes to specify the maximum number of rows that should be returned.

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

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

A

Data rows can be batch inserted into a database table by specifying more than one tuple of values, separated by commas.

17
Q

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

A

returning clause

18
Q

How do you update rows in a database table?

A

update keyword then the table

set the value on the column you want to update

19
Q

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

A

so it targets the specific rows

20
Q

How do you delete rows from a database table?

A

delete statement then “from” and target row

21
Q

How do you accidentally delete all rows from a table?

A

delete statement then the table or delete table then where = true