CH15: Databases and SQL Flashcards

1
Q

____ the database in the MySQL file tree to set the model as the default option for SQL commands

A

double click

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

PRIMARY KEY

A

unique identifier in the table

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

How does AUTO_INCREMENT affect a new entry to a table?

A

assigns every new entry a different integer value

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

What does the following SQL cmd accomplish?
INSERT INTO seeds (crop, encourages, use_by)
VALUES (“Agastache”, “bees & hummingbirds”, 2020);

A

Adds new entry to seeds table in listed columns

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

___ is stored in a column when a value for a field is not supplied

A

null

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

If you leave out the ____ clause in a SQL UPDATE or DELETE FROM command, ALL records in a table are updated/deleted

A

WHERE

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

SELECT * FROM example_table

A

Select all entries in a table

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

Use the ___ to import csv files into a table

A

Table Data Import Wizard

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

Define persistent data source

A

Data that is stored after process that created it has ended. It is written to non-volatile storage

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

What does ACID stand for in database transactions?

A

Atomicity
Isolation
Consistency
Durability

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

Define atomicity

A

transaction treated as single unit

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

Define consistency

A

transaction can only bring the database from one valid state to another

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

Define Isolation

A

Transactions often execute concurrently (multiple reading and writing to table). Isolation ensures this execution leave DB in same state as sequential execution

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

Define Durability

A

Guarantees once transaction committed, stays that way, even in the event of system failure

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

Define Relational Database

A

collection of data items with pre-defined relationships between them

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

What is a RDMS, name one example

A

A tool used to interact with data stored in a table. SQL is a common example

17
Q

True/False: STRING is a SQL data type

A

False, VARCHAR handles strings in SQL

18
Q

What is the data type for handling integers in SQL?

A

INT (also DOUBLE, BIGINT, MEDIUMINT)

19
Q

Which SQL datatype are BOOL and BOOLEAN synonymous with?

A

TINYINT (0 = false, 1 = true)

20
Q

What is CRUD?

A

Create
Read
Update
Delete

These are the 4 major operations performed when working with data.

21
Q

How would you scaffold an update to a table?

A

UPDATE
SET
WHERE

22
Q

How would you scaffold adding a column to a table?

A

ALTER TABLE

ADD

23
Q

How would you scaffold creating a table from another table?

A

CREATE TABLE
AS SELECT
FROM
WHERE

24
Q

How would you scaffold deleting an entry from a table?

A

DELETE FROM

WHERE

25
Q

What purpose does a join serve

A

Use when combining querying two tables to create one result set

26
Q

List the 4 types of joins in SQL

A

Inner Join
Left Outer Join
Right Outer Join
Full Outer Join

27
Q

What is the general syntax of a join?

A

FROM table_a

TYPEOFJOIN JOIN table_b ON table_a.column_name_1 = table_b.column_name_1;

28
Q

Joining two tables with an _______ produces a result set that only includes the values that are present in both tables

A

inner join

29
Q

Joining two tables with a _________ gives us a result set which includes all values in the left table and any matching records from the right table.

A

left outer join

30
Q

Joining two tables with a _____ gives us a result set that includes all records from both tables. The syntax is not supported in MySQL

A

full outer join