Live Lecture Materials Week 12 Flashcards

(29 cards)

1
Q

The 2 different techniques used to query data from multiple tables

A

Join and subquery

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

If you want to use a query but don’t know the specific obscure values necessary to do so, what can you do?

A

Use a select statement + a where clause to find the obscure value(s)

ie.
SELECT SKU
FROM SKU_DATA
WHERE Department = ‘Sport’

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

Another term for a subquery

A

A nested query

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

T/F - Data is stored in individual tables, it’s the relationship between the tables that make the data meaningful

A

True

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

Explicit join

A

The JOIN operator is used as part of the SQL statement

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

Implicit join

A

The JOIN operator is not used as part of the SQL statement

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

Joins can be used on

A

Tables
Views
Materialized views

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

NATURAL JOIN

A
  • Creates a join based on common attributes
  • No duplicates returned
  • If there’s no common column, it’s downgraded to a CROSS JOIN
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

CROSS JOIN

A

Combines each row in one table with every row in another table

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

The problem with CROSS JOINs or “Cartesian Products”

A

The nature of CROSS JOINs is illogical for database work, we want rows and tables that are related to each other, not random

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

An Inner join matches _______ ____ and ________ ____ of two tables

A

Primary and foreign keys

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

When you’re using an implicit join and a field name is the same in both tables, you need

A

To add the table name when you type a field

ie. Inventory.name

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

Equijoin

A

A join based on identical column values

The two tables are joined using an “equal to” condition

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

Today ________ joins are considered proper, and _______ joins are considered archaic

A

explicit, implicit

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

You can create a table alias using ________ joins

A

explicit

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

In an inner join, records that have ________ ______ are selected. ____ values are omitted

A

matching values, NULL

17
Q

Left outer join

A
  • Returns all records from the left table, only matching records from right
  • If there are no matches in the right table, it returns NULL
18
Q

Right outer join

A
  • Returns all records from right table, only matching records from left
  • If 0 matches, the join still returns a column, but it will be NULL in each row
19
Q

What is a set? What is set theory?

A

A set is a collection of distinct data items. Set theory refers to
Mathematical operations on sets.

20
Q

A relational database table meets the definition of a set, so SQL includes a group of ___ _________ to use in SQL

A

set operators

21
Q

The standard method of visualizing sets and their relationships

A

Venn diagrams

22
Q

In a Venn diagram a set is represented by a _______ ______, a ______ is a portion of a set that is contained entirely within the set

A

labelled circle, subset

23
Q

The entire area of both sets in a Venn diagram is called a _____, it is the equivalent to an __ operator

24
Q

Venn Diagram: the ____________ part of two sets is fittingly called an ____________ and is equivalent to an ___ operator

A

intersecting intersection, AND

25
Venn Diagram: The ___________ is the area of a set that is not part of the set it is intersecting with. It is equivalent to a ___ operator
complement, NOT
26
Prerequisites to use SET operations
1. The number of columns must be same 2. The data types must be identical
27
Union operator meaning
The entire collection of values in 1 or 2 tables, depending on context
28
Intersect operator meaning
The shared values of two tables
29
Except operator meaning
All non-shared values of both tables