Upload
noreen-craig
View
230
Download
4
Embed Size (px)
Citation preview
Cloudacus = LAMP + Appaserver
©Tim Riley
Appahost ModelAppahost Model
Why LAMP?
©Tim Riley
Why Linux?Why Apache?
Why MySQL?Which Programming
Language?
What is a structured database?
©Tim Riley
Cloudacus = LAMP + Appaserver
Appahost ModelAppahost Model
What is a structured database?
Set Name
©Tim Riley
Database sets are also known as:* categories* tables* folders* collections
What is a structured database?
Set Name
Attribute 1 datatypeAttribute 2 datatype …Attribute n datatype
Attributes are also known as:* columns* fields* properties
©Tim Riley
What is a structured database?
Set Name
Attribute 1 datatypeAttribute 2 datatype …Attribute n datatype
Examples of datatypes:* Integer number* Floating point (real) number* Date* Time* Line of text* Notepad of text
©Tim Riley
Example Set
Personfull_name textskin_color textreligion textheight_inches integerweight_pounds integerbirth_date dateannual_income floatgeneral_characterists notepad
©Tim Riley
Set Elements
PersonFull Name
Linus Torvalds
Guido van Rossum
Bill Henry Gates III
Sets contain elements
©Tim Riley
Elements are also known as:* members* records* rows* tuples
Making Subsets
Personfull_name textskin_color textreligion textheight_inches integerweight_pounds integerbirth_date dateannual_income floatgeneral_characterists notepad
©Tim Riley
Set Relationships
©Tim Riley
Set 1 Set 2Verb phrase
Set Relationships
Person StateReside in
©Tim Riley
Many Set Relationships
©Tim Riley
Person StateReside in
School
Attend
Many Set Relationships
Person StateReside in
Born in
©Tim Riley
Set Relationship TypesSet 1
There are 5 types of set relationships:1) many-to-one2) one-to-many3) many-to-many4) one-to-one5) is-a
Set 2Verb phrase
©Tim Riley
Many-to-one RelationshipPerson
”Many persons
StateReside in
many one
one state.”reside in
©Tim Riley
One-to-many RelationshipPerson
Reverse the arrow to reverse the relationship. ”One state has as residents many persons.”
StateHas resident
many one
©Tim Riley
Many-to-many RelationshipPerson
”One person can visit many states. And one state can have as visitors many persons.”
StateVisit
many many
©Tim Riley
One-to-one RelationshipOffice
”One office has one phone.”
PhoneHas
one one
©Tim Riley
Is-a RelationshipAccountant
”An accountant is a person.”
PersonIs a
one one
©Tim Riley
Enforcing Business Rules
Two broad categories of business rule enforcement are:
1) Implementational restrictions (bad)2) Integrity constraints (good)
©Tim Riley
Enforcing Business Rules
Implementational restrictions are business rules the information system cannot enforce.
Person StateReside in
many one
©Tim Riley
Implementational Restrictions
©Tim Riley
Person StateVisit
many many
one one
many
Implementational Restrictions
©Tim Riley
Person State
many
Person Visit
Enforcing Business RulesIntegrity constraints are business rules the information system succeeds at enforcing. Two imperative integrity constraints are:
1) Relational integrity2) Element uniqueness
©Tim Riley
Enforcing Business RulesRelational integrity is the constraint that an element in each set must exist in order for a relationship to exist between them.
Person StateReside in
many one
A state element can exist without any persons residing in it.
A person element can exist without residing in a state.
©Tim Riley
Enforcing Business RulesElement uniqueness is the constraint that an element cannot exist more than once in a set.
Personfull_name text *
Only one person named Bill Henry Gates III can belong to the person set.
The set of attributes enforcing uniqueness is called the primary key.
©Tim Riley
Element UniquenessNatural primary key: the set of attributes that naturally enforce uniqueness.
Personfull_name text *street_address text *
Names are likely to be naturally duplicated.
If a set has more than one attribute assigned to its primary key, then it's called a multi-attribute primary key.
©Tim Riley
Element Uniqueness
Primary keys naturally occur.
To identify the natural primary key, always consider the four dimensions. Uniqueness can always be naturally identified with:
1) Longitude2) Latitude3) Elevation4) Time
All of the organization's places should be categorized.
All events need a date/time stamp.
©Tim Riley
Foreign key: in a many-to-one relationship, the many table needs to have as attributes the primary key of the one table.
Personfull_name text *street_address text *state text
Statestate text *
Reside in
many one
Foreign key is the primary key of the one table.
Primary key of the one table.
©Tim Riley
Element Uniqueness
Element UniquenessMutable primary keys: The value of primary keys can change when using Appaserver.
Personfull_name text *street_address text *
©Tim Riley
You can change the person's name if she gets married or change the street address if he moves.
Story Telling: Seabed Study
©Tim Riley
©Tim Riley
Cloudacus = LAMP + Appaserver
Appahost ModelAppahost Model
©Tim Riley
Cloudacus = LAMP + Appaserver
Appaserver's Database Structure
Tabletable_name text *
Columncolumn_name text *
Is described
by
many many
Table is the relational database synonym for set.
Column is the relational database synonym for attribute.
©Tim Riley
Table ColumnIs
described by
many many
Appaserver's Database Structure
©Tim Riley
Appaserver's Database Structure
Folderfolder text *
Attributeattribute text *
many many
Appaserver stores tables in the table called ”Folder.”
Appaserver stores columns in the table called ”Attribute.”
©Tim Riley
one one
manymany
Appaserver's Database StructureFolder
folder text *
Attributeattribute text *
Folder_Attributefolder text *attribute text *
©Tim Riley
Appaserver's Database Structure
Storing Relationships
Person
StateReside in
SchoolAttend
©Tim Riley
Appaserver's Database Structure
Storing Relationships
Person
Accountant Teacher
Is aIs a
©Tim Riley
Appaserver's Database Structure
Storing Relationships
Folder Has relationship
many
many
©Tim Riley
Appaserver's Database Structure
Storing Relationships
Folder Relation
©Tim Riley
Relational Database Operations
©Tim Riley
1) Select2) Insert3) Update4) Delete
Building Non-trivial Databases
©Tim Riley
Appaserver's Screen Types
©Tim Riley
1) Insert2) Lookup3) Update4) View5) Detail
Insert Screen
©Tim Riley
Insert Screen
©Tim Riley
Lookup Screen
©Tim Riley
Update Screen
©Tim Riley
View Screen
©Tim Riley
Detail Screen
©Tim Riley
©Tim Riley
Cloudacus = LAMP + Appaserver
Appahost ModelAppahost Model