Week 7 - SQL Flashcards

1
Q

What’s a lambda function?

A

It’s an anonymous function (no name)

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

How does a relational database store data?

A

In rows and columns, like a spreadsheet

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

What are the four SQL commands?

A
  1. Create, insert
  2. Select (read)
  3. Update (find and replace)
  4. Detele (rows), drop (table)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How strings must be surrounded in SQL?

A

With single quotes

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

What are SQL five data types?

A
  • Blob (binary)
  • Integer
  • Numeric (numbers with other chars. like dates)
  • Real (float - decimal points)
  • Text (strings)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the two SQL constraints keywords?

A

Not null and Unique

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

What are primary and foreign keywords used for in SQL?

A

To teach the database what is related to what

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

What are Btrees?

A

Data structs. in SQL that allow us to have more than two children per node

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

What are Btrees used for?

A

To create indexes and reduce search time

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

What’s the downside of Btrees?

A

Additional memory space is required

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

Which columns should be indexed in Btrees?

A

The ones that will probably be used more frequently

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

When does a “Race condition” happen?

A

When data is lost because it is being updated by multiple sources simultaneously

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

How to solve the “Race condition”?

A

With the TRANSACTION keyword

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

Why choosing the primary key wisely makes subsequent operations much easier?

A

Because primary keys enable rows of a table to be uniquely and quickly identified

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

What will LIKE “% Potter” do?

A

Find everybody with a “Potter” somewhere on the name

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

What will LIKE “H %” do?

A

Find everybody whose name starts with an “H”

17
Q

What is the JOIN keyword used for?

A

To combine data from different tables