Date post: | 08-Jan-2018 |
Category: |
Documents |
Upload: | amberlynn-dorsey |
View: | 217 times |
Download: | 1 times |
IE 423 – Design of Decision Support SystemsData modeling and database development
AnnouncementsMidterm Exam – March 3, 2008
By now you should haveRead Chapters 1,2 & 3 in Pol and AhujaAlso, read chapter 4 in Pol and Ahuja
Data ModelingWhen you develop any computer based application…You should start by developing a model of the thing or the process that you want to develop the software aboutYou start by developing an abstract model
Data ModelingThis modeling process helps you think through what you are trying to buildSoftware development is largely a cognitive processIts about planning
Data ModelingSo, we get some Play-Dough
Or make your own: http://www.teachnet.com/lesson/art/playdough061699.html
From: http://www.truecoaching.com/truecoaching/images/page_headers/play_dough.JPG
Data ModelingOK, forget the play-doughSo, how do you model this thing/processYou could get a piece of paper and start drawing a diagram……but there are more systematic ways of doing this
Data ModelingProbably best to start out with Object modeling Identify the objects that are involved These objects are entities So, sometimes we will call these
entities These can be tangible objects, or… …abstract object
Data ModelingObject modeling Consider a course registration system
Some objects would be Students Courses Instructors Rooms …
Data ModelingObject modeling Each object has a number of
attributes associated with it Define these attributes
Data ModelingObjects and attributes Student
StudentId Name Rank TelephoneNumber EmailAddress EyeColor FootSize
Data ModelingObjects and attributesBut, we only need attributes that relevant to the task Student
StudentId Name Rank TelephoneNumber EmailAddress EyeColor FootSize
Data ModelingObjects and attributesSome important ideas Entity (object) Type = the class of the entity
Generic definition of the entity Remember Metadata? Student
Entity Instance = a single case Student with ID = 2223334444
Entity Set = a set or collection of entity instances Students in IE 423
Data ModelingObjects and attributesBy the way, not so important now, but as a heads-upWe will use a particular naming conventions for naming objects and attributes Each word in a name is lower case, but the first
character of the word is upper case For multi-word names, cram the words together
(no space), and the first character of each word is upper case, others lower case (i.e. FirstName )
This is called CamelBack notation
Data ModelingObjects and attributesThere are several types of attributes Simple (sometimes called atomic, nothing to
do with nuclear physics) These have single values, can’t be divided
Composite Attributes Could be decomposed into other attributes
(probably simple, but not necessarily) Name = FirstName, LastName
Multivalue Can have multiple values at the same time for an
entity instance LanguageProficiency = French, Spanish, German CarsOwned? Age?
Data ModelingObjects and attributesThere are several types of attributes Stored attribute – value is given and
stored as is Derived attribute – the value for a
given instance is derived from other available information Not stored Later we will call this a calculated value When would we want to do this?
Data ModelingObjects and attributesEvery entity/object should have an identifier that will uniquely identify each instance
Can’t be two instances with the same value StudentId This is called a Key
Name IDBob Smith 2223334441Bob Smith 2223334442
Data ModelingObjects and attributes Sometimes you may not have a simple key For example, Name is often not unique Can have two or more attributes that
together uniquely identify an entity instance Called a Composite Key
Player Team NumberBob Smith 1 5Jerry Jones 1 7Bob Smith 2 5Sam Smit 2 8
Data ModelingObjects and attributes A set of attributes for an entity is
called a relation Not to be confused with relationship
Computer scientists and mathematicians call relations – tuples *(GWOTD)
Data ModelingRelationships Occasionally, an important problem
will involve a single entity (and its attributes) but usually not
Multiple entities are often related We call that connection
between/among entities a relationship
Data ModelingDegree of Relationship How many entities are involved in the
relationship Unary – two instances of the same
entity type Binary – two instances of the two
different entity types Ternary – three instances from three
different entity types
Data ModelingCardinality of Relationship How many entity instances are
involved in the relationship This means the number of instance
from one side of relationship to the number from the other side
But you need to know two numbers One Many
Photo from: http://www.growingwisdom.com/index.aspx?pid=16&sid=1&cid=88
Data ModelingCardinality of Relationship So, we have three types of
relationships in terms of cardinality (maximum cardinality)One-to-OneOne-to-ManyMany-to-Many
Data ModelingCardinality of Relationship One-to-One
One instance of one entity can only match one instance from other entity
One wife is marriedto one husband (some places) and vice versa
Husbands Wivesmarriedto
Data ModelingCardinality of Relationship One-to-Many
One instance of one entity can match multiple instances from other entity
A customer can place many orders, but an order is ordered by only one customer
Data ModelingCardinality of Relationship Many-to-Many
Each instance of one entity can match multiple instances from other entity and the other entity can match multiple instances from the first entity
A student can take multiple classes and each class has multiple students
(btw – this is tricky in a RDBMS – we will get back to this)
Data ModelingCardinality of Relationship Minimum cardinality
The minimum number of instances from each entity in a relationship to the other entity in the relationship
You need to worry about two numbers
Zero – it is possible to have an unmatched entity
One – a relationship must have at least one match from each side of the relationship (no unmatched entities)
Data ModelingCardinality of Relationship Minimum cardinality
This will be important when we talk about –
Finding disjoint sets Who did not do this, or have
that? Referential integrity