L4 Multi-table queries Flashcards

1
Q

What null values are used for in the relational model?

A
  • value unknown:
    • e.g. perhaps we know that a pub sells a certain beer but we don’t know the price.
  • value inapplicable:
    • e.g. the value for a spouse attribute of an unmarried person could be NULL.
  • value witheld:
    • e.g. perhaps we don’t wish to reveal where a person lives.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe three situations in which the use of null values either complicates the syntax of SQL or makes query processing more involved.

A
  • aggregation: Aggregate (summary) functions such as COUNT(), MIN(), and SUM() ignore NULL values.
    • The exception to this is COUNT(*), which counts rows and not individual column values.
  • In SQL, the NULL value is never true in comparison to any other value, even NULL.
    • To search for column values that are NULL, you cannot use an expr = NULL test because expr = NULL is never true for any expression
  • For some data types, MySQL handles NULL values specially: If you insert NULL into a TIMESTAMP column, the current date and time is inserted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is three-valued logic?

A

a logic systems in which there are three truth values indicating true, false and some indeterminate third value ( NULL in case of sql)

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

What is a left outer join?

A

includes all tuples from the left relation, padded with NULL values, where no matching tuples exist in the right relation.

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

What is a Natural join operation?

A
  • equates all pairs of attributes from the two relations having a common name
  • projects out one of each pair of equated attributes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly