sets and set operations

14
Sets and Set Operations A set is an unordered collection of objects called elements Explicit definition Implicit definition Two sets A and B are equal if every element in A is also in B and every element in B is also in A (A = B) A is contained in B if every element in A is also an element of B (A B) Example: Φ A for every set A

Upload: tuwa

Post on 06-Jan-2016

18 views

Category:

Documents


0 download

DESCRIPTION

Sets and Set Operations. A set is an unordered collection of objects called elements Explicit definition Implicit definition Two sets A and B are equal if every element in A is also in B and every element in B is also in A (A = B) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Sets and Set Operations

Sets and Set Operations

A set is an unordered collection of objects called elements

Explicit definition Implicit definition

Two sets A and B are equal if every element in A is also in B and every element in B is also in A (A = B)

A is contained in B if every element in A is also an element of B (A B)

Example: Φ A for every set A

Page 2: Sets and Set Operations

Sets and Set Operations

The power set of A, Ρ (A) is the set of all subsets of A

Example: Ρ (Φ) = {Φ} The cross product of two sets A x B = { (a, b) | a A and b B} order is important: A x B B x A in general (x is not commutative)A relation is a subset of A x B cross product can be generalized

Page 3: Sets and Set Operations

Sets and Set Operations

Set operations:

Union A B Intersection A B Difference A B

Complement (Universe of discourse) A

Venn diagram

Page 4: Sets and Set Operations

Useful relations

| A B | = |A| + |B| - |A B|

DeMorgan’s law

co(A B) = co(A) co(B)

DeMorgan’s law can be generalized

Page 5: Sets and Set Operations

Propositions

A proposition P is a statement that is either true or false

Example

P : It is raining today in Chicago

Compound propositions and their truth values

P or Q (P V Q), P and Q (P Λ Q),

not P (¬P , or P), P Q, P Q

Page 6: Sets and Set Operations

Propositions

DeMorgan’s laws

¬(P1 V …V Pn ) = (¬P1) Λ … Λ (¬Pn)

¬ (P1 Λ … Λ Pn ) = (¬P1) V … V (¬Pn)

Page 7: Sets and Set Operations

Databases

A database is a system that allows storage and manipulation of information

A database management system (DBMS) is a combination of hardware and software that allows organization and manipulation of the information

Page 8: Sets and Set Operations

Databases

Why are databases important?

databases vs. Archiving, large size of data,

quick access and manipulation

How and why are databases used?

1. DB models aspects of the real world 2. Collection of data

• logically coherent• Meaningful

3. Designed for specific purpose

Page 9: Sets and Set Operations

Uses of Databases

• Traditional (airline reservation, school, hospital, …)• Online Shopping• Search Engines• Genetic Databases• Geographical Information Systems

Page 10: Sets and Set Operations

Sizes of Database

• Personal (1 User), Megabytes

• Workgroup (<25 Users), Megabytes

• Organizational (100-1000s), Gigabytes

• Internet (100-1000s), Terabytes

Page 11: Sets and Set Operations

How do database represent Info.

The physical database: a collection of files containing the data content

The schema: a specification of the physical database’s information content and logical structure

The database engine: software that lets people access and modify the database contents

The data definition and manipulation languages: SQL (Structured Query Language)

Page 12: Sets and Set Operations

Relational database manag. Systems (RDBMS)

RDBMSTables of data

Schema • Name of table

• Names and types of attributes

Contents• Row is a fact

• Attribute value is a characteristic

Page 13: Sets and Set Operations

Example

Customer table accountId Last N. First N.

101 Block Jane

102 Hamilton Cherry

103 Harrison Kate

104 Breaux CarrollLogical description

(Schema)Customer (accountId, lastName, firstName)

Table creation statement

create table Customer (accountId integer, lastName char(20), firstName char(20))

Page 14: Sets and Set Operations

Client/Server Interaction

Client Computer

Server Computer

queries and updates

results

network connection

disk

tables

DBMS