Sequel/Databases Flashcards

1
Q

What is SQL and how is it different from languages like JavaScript?

A

coding language used to interact with databases

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

How do you retrieve specific columns from a database table?

A

select

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

How do you filter rows based on some specific criteria?

A

where “column” = ‘condition’

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

What are the benefits of formatting your SQL?

A

more easily readable

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

What are four comparison operators that can be used in a where clause?

A
=
<
><=
>=
<> (not equal)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A

limit (number);

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

How do you retrieve all columns from a database table?

A

select *

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

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

A

desc keyword after the statement

order by “price” desc

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

How do you add a row to a SQL table?

A

insert into “table” (values)

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

What is a tuple?

A

In SQL, a list of values is referred to as a tuple.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
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
13
Q

How do you update rows in a database table?

A

update statement

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

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

A

sets a limit to prevent all values from being changed

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

How do you delete rows from a database table?

A

delete statement

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

How do you accidentally delete all rows from a table?

A

dont include a where statement

17
Q

What is a foreign key?

A

a value in a column that can be used to link two tables

18
Q

How do you join two SQL tables?

A

select “firstName”,
“lastName”
from “customers”
join “payments” using (“customerId”)

19
Q

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

A

aliases

20
Q

What are some examples of aggregate functions?

A

Aggregate functions compute a single result from a set of input values. sum() avg()

21
Q

What is the purpose of a group by clause?

A

to separate rows into groups and perform aggregate functions on those groups of rows

22
Q

What are the three states a Promise can be in?

A

pending, rejected, fulfilled

23
Q

How do you handle the fulfillment of a Promise?

A

.then

24
Q

How do you handle the rejection of a Promise?

A

.catch

25
Q

What does fetch() return?

A

returns a promise containing the response (a Response object).

26
Q

What is the default request method used by fetch()?

A

get

27
Q

How do you specify the request method (GET, POST, etc.) when calling fetch?

A

with the 2nd parameter (init)
fetch(‘link’, {
method: ‘POST’
}

28
Q

When does React call a component’s componentDidMount method?

A

after the first successful render

29
Q

Name three React.Component lifecycle methods.

A

constructor render componentdidmount

30
Q

How do you pass data to a child component?

A

props

31
Q

What does express.static() return?

A

a middleware function

32
Q

What is the local __dirname variable in a Node.js module?

A

The directory name of the current module. This is the same as the path.dirname() of the __filename.

It starts with / so it is absolute file path since it starts at the root of the file system

33
Q

What does the join() method of Node’s path module do?

A

The path.join() method joins all given path segments together using the platform-specific separator as a delimiter, then normalizes the resulting path.