Relational Databases-Lecture 12 Slides-Computer Science, Slides of Relational Database Management Systems (RDBMS)

Relational Databases, Relational Calculus and Logic, Syntax and Semantics, Procedural Vs Declarative, SQL, Relational Algebra, Relational Calculus, Logic, Validity, Systems of Formal Logic, Boolean Algebra, Aristotle, Translation Key, First Order Logic, Database as Interpretation, Dr Mohammad Yamin, Ms Zoe Brain, Lecture Slides, Relational Databases, Australian National University, Australia.

Typology: Slides

2011/2012

Uploaded on 03/12/2012

kyleaus
kyleaus 🇦🇺

5

(4)

12 documents

1 / 153

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Relational Databases - Comp2400 / Comp6240
Lecture 16: Relational Calculus and Logic
Logic and Databases
From relational algebra to relational calculus, and other
logic-database connections.
relational calculus
logic
syntax and semantics of first order logic
parallels between first order logic and relational databases
Read [E&N §6.6, §6.7, §8.5.4] for more on todays stuff.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Relational Databases-Lecture 12 Slides-Computer Science and more Slides Relational Database Management Systems (RDBMS) in PDF only on Docsity!

Relational Databases - Comp2400 / Comp

Lecture 16: Relational Calculus and Logic

Logic and Databases

From relational algebra to relational calculus, and other logic-database connections.

relational calculus logic syntax and semantics of first order logic parallels between first order logic and relational databases

Read [E&N §6.6, §6.7, §8.5.4] for more on todays stuff.

Procedural vs Declarative

Last week we saw relational algebra. Relational calculus is another formal database language, more like logic than algebra.

Procedural vs Declarative

Last week we saw relational algebra. Relational calculus is another formal database language, more like logic than algebra.

That is, relational calculus expressions say what you want, rather than how to find out.

Actually, its not black and white. Consider the differences between the following 3 equivalent queries.

Three different ways

SQL

SELECT bdate, address FROM employee WHERE salary > 50000

Three different ways

SQL

SELECT bdate, address FROM employee WHERE salary > 50000

relational algebra

πbdate,address(σ(salary> 50000 )(employee))

relational calculus (see [E&N, §6.6.1])

{t.fname, t.address | employee(t) ∧ t.salary > 50000 }

Relational Calculus Observations

{t.fname, t.address | employee(t) ∧ t.salary > 50000 }

it is based on “set-builder” notation

Relational Calculus Observations

{t.fname, t.address | employee(t) ∧ t.salary > 50000 }

it is based on “set-builder” notation variable t stands for a tuple attribute names are functions, writing t.fname for fname(t)

Relational Calculus Observations

{t.fname, t.address | employee(t) ∧ t.salary > 50000 }

it is based on “set-builder” notation variable t stands for a tuple attribute names are functions, writing t.fname for fname(t) relation names are predicates

Relational Calculus Observations

{t.fname, t.address | employee(t) ∧ t.salary > 50000 }

it is based on “set-builder” notation variable t stands for a tuple attribute names are functions, writing t.fname for fname(t) relation names are predicates

To make proper sense of this, we need to understand a bit about formal logic.

Logic101 in Ten Minutes

Logic

What is Logic? History of logic and computation Main ideas of logic: statement (syntax) situation (semantics) truth argument validity proof Syntax and semantics of first order logic (but not deduction)

What is Logic?

Logic is the study of good reasoning.

Is the reasoning in the following two examples good? Why, or why not?

Example 1

The drums are louder than the bass. The guitar is louder than the drums. Therefore, the guitar is louder than the bass.

Example 2

I told the bass player to turn it down or I’d punch his head in. Therefore, the guitar is louder than the bass.

What is Logic?

Logic is the study of good reasoning.

Is the reasoning in the following two examples good? Why, or why not?

Example 1

The drums are louder than the bass. The guitar is louder than the drums. Therefore, the guitar is louder than the bass.

Example 2

I told the bass player to turn it down or I’d punch his head in. Therefore, the guitar is louder than the bass.

Logic seeks theories of good reasoning, to give answers and explanations to questions like these.

Logic provides tools for precise work with ideas

Logic came from philosophers trying to understand, explain and even improve the certainty of mathematical arguments. Philosophers use formal logic to analyse concepts into more basic ideas, and solve problems caused by the confusion of English.

Logic provides tools for precise work with ideas

Logic came from philosophers trying to understand, explain and even improve the certainty of mathematical arguments. Philosophers use formal logic to analyse concepts into more basic ideas, and solve problems caused by the confusion of English.

Example 3

Nothing is better than a holiday in St Tropez. A ham sandwich is better than nothing. Thus, a ham sandwich is better than a holiday in St Tropez.