Difference between revisions of "Entities and Attributes"

From rbachwiki
Jump to navigation Jump to search
 
(22 intermediate revisions by the same user not shown)
Line 1: Line 1:
*Conceptual model: A data model, usually represented by an entity relationship diagram (ERD)
==Entity Defined==
** The client dream would be the conceptual model
#Something of significance to the business about which data must be known
*Physical model: A design for an object (a car, a house, a database, etc) which includes implementation details such as size, volume, weight, etc)
#A name for a set of similar things that you can list
** The physical reality will become the physical model
#Usually a noun
*All many-to-many relationships must be reduced to a set of on-t--many relationships
#Examples: object, events, people
#Entities have instances
#An instance is a single occurrence of an entity
[https://www.dropbox.com/s/lv1njvxls0lryth/entities.jpg?dl=0 Entities Table]
 
* A Dalmatian, a Siamiese cat, a Cow are instances of ANIMAL
* A convertible, a sedan, a Station wagon are instances of CAR
* Some entities have many instances and some have only a few
* Entities can be:
** Tangible, like PERSON, or PRODUCT
** Intangible, like SKILL LEVEL
** An Event, like CONCERT
 
==WHAT IS AND ATTRIBUTE==
* An attribute represents something of significance to the business
* An attribute is a specific piece of information that helps:
** Describe an Entity
** Quantify an Entity
** Qualify an Entity
** Classify an Entity
** Specify an Entity
* An attribute has a single value
[https://www.dropbox.com/s/63nal8gyswdnnya/attributes.jpg?dl=0 Attribute Table]
 
==Relationship==
: Association between 2 or more entities
 
;Conceptual model: A data model, usually represented by an entity relationship diagram (ERD)
: The client dream would be the conceptual model
;Physical model: A design for an object (a car, a house, a database, etc) which includes implementation details such as size, volume, weight, etc)
: The physical reality will become the physical model
;All many-to-many relationships must be reduced to a set of on-t--many relationships
 
==ERD Entity relationship diagram==
:An entity relationship diagram (ERD) is a consistent tool that can be used to represent the data requirements of a business regardless of type of database that is used, and even in the absence of one
 
== Implementation-Free Models==
*A good conceptual data model stays the same regardless of the type of database the system is eventually built or implanted on, This is what is meant by saying the model is implementation-free
*The data model should stay the same even if a database is not used at all
 
==What is an Entity Relationship Model==
# A list of entities and attributes as well as all relationships between the entities that are of importance
# Provided background information such as entity descriptions, data types, and constraints
# NOTE: The model does not require a diagram, but the diagram is typically a very useful tool
 
==Goals of ER Modeling ==
*Capture all required information
*Ensure that information appears only once
*Model no information that is derivable from other information already modeled
*Locate information in a predictable, logical place
==Database Normalization==
==Database Normalization==
'''Storing data in a normalized format means only one update is required to reflect the new address, and it should always be the one that appears whenever your mailing address is needed.'''
'''Storing data in a normalized format means only one update is required to reflect the new address, and it should always be the one that appears whenever your mailing address is needed.'''
===Many people unfamiliar with database design principles often ask, “Why not just put all the data in one big table?” This single-table approach leads to problems of data redundancy (duplication) and data anomalies (data inconsistencies).===
#Many people unfamiliar with database design principles often ask, “Why not just put all the data in one big table?” This single-table approach leads to problems of data redundancy (duplication) and data anomalies (data inconsistencies).
===To avoid these data issues, database normalization is used to create a design that reduces or eliminates data redundancy and, therefore, avoids data anomalies. In general, normalization helps database designers determine which attributes, or fields, belong to each entity. In turn, this information helps determine which fields belong in each table. Normalization is a multistage process that enables designers to take the raw data to be collected about an entity and develop the data into a structured, normalized form that reduces the risks associated with data redundancy. Data redundancy poses a special problem in databases because storing the same data in different places can cause problems when updates or changes to data are required.===
#To avoid these data issues, database normalization is used to create a design that reduces or eliminates data redundancy and, therefore, avoids data anomalies. In general, normalization helps database designers determine which attributes, or fields, belong to each entity. In turn, this information helps determine which fields belong in each table. Normalization is a multistage process that enables designers to take the raw data to be collected about an entity and develop the data into a structured, normalized form that reduces the risks associated with data redundancy. Data redundancy poses a special problem in databases because storing the same data in different places can cause problems when updates or changes to data are required.
===When a record contains repeating groups (that is, multiple entries for a single column), it’s considered unnormalized. First-normal form (1NF) indicates that all values of the columns are atomic—meaning they contain no repeating values. To convert records to 1NF, remove the repeating  values by making each author entry a separate record,===
#When a record contains repeating groups (that is, multiple entries for a single column), it’s considered unnormalized. First-normal form (1NF) indicates that all values of the columns are atomic—meaning they contain no repeating values. To convert records to 1NF, remove the repeating  values by making each author entry a separate record,
===When more than one field is used as the primary key for a table, the combination of fields is usually referred to as a composite primary key===
#When more than one field is used as the primary key for a table, the combination of fields is usually referred to as a composite primary key
'''Now that the repeating values have been eliminated and the records can be identified uniquely, the data is in 1NF'''
'''Now that the repeating values have been eliminated and the records can be identified uniquely, the data is in 1NF'''
===A problem known as partial dependency can occur when the primary key consists of more than one field. Partial dependency means the fields contained in a record (row) depend on only one portion of the primary key===
;A problem known as partial dependency can occur when the primary key consists of more than one field. Partial dependency means the fields contained in a record (row) depend on only one portion of the primary key
'''By removing Partial dependency your table is now second-normal-form (2NF)'''
'''By removing Partial dependency your table is now second-normal-form (2NF)'''
===A transitive dependency means at least one value in the record isn’t dependent on the primary key but on another field in the record. In this case, the contact person from the publisher’s office is actually dependent on the publisher, not on the book.===
:A transitive dependency means at least one value in the record isn’t dependent on the primary key but on another field in the record. In this case, the contact person from the publisher’s office is actually dependent on the publisher, not on the book.
 
== Levels of Normalization==
# 1NF: Eliminate all repeating values and identify a primary key or primary composite key.
# 2NF: Make certain the table is in 1NF and eliminate any partial dependencies.
# 3NF: Make certain the table is in 2NF and remove any transitive dependencies.
'''A many-to-many relationship can’t exist in a relational database. The most common approach to eliminating a many-to-many relationship is to create two one-to-many relationships by adding a bridging entity. A bridging entity is placed between the original entities and serves as a “filter” for the data.'''
 
==SQL Command Types==
;Query
:SELECT(Retrieve the data values)
;Data manipulation language (DML)
:INSERT, UPDATE, DELETE (Create or modify data values)
;Data definition language (DDL)
:CREATE, ALTER, DROP (define data structures)
; Transaction control (TC)
: COMMIT, ROLLBACK (Save or undo data value modifications)
;Data control language(DCL)
: GRANT, REVOKE (Set permissions to access database structures)
 
----
 
[[#Entity Defined|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]]

Latest revision as of 14:40, 12 September 2017

Entity Defined

  1. Something of significance to the business about which data must be known
  2. A name for a set of similar things that you can list
  3. Usually a noun
  4. Examples: object, events, people
  5. Entities have instances
  6. An instance is a single occurrence of an entity

Entities Table

  • A Dalmatian, a Siamiese cat, a Cow are instances of ANIMAL
  • A convertible, a sedan, a Station wagon are instances of CAR
  • Some entities have many instances and some have only a few
  • Entities can be:
    • Tangible, like PERSON, or PRODUCT
    • Intangible, like SKILL LEVEL
    • An Event, like CONCERT

WHAT IS AND ATTRIBUTE

  • An attribute represents something of significance to the business
  • An attribute is a specific piece of information that helps:
    • Describe an Entity
    • Quantify an Entity
    • Qualify an Entity
    • Classify an Entity
    • Specify an Entity
  • An attribute has a single value

Attribute Table

Relationship

Association between 2 or more entities
Conceptual model
A data model, usually represented by an entity relationship diagram (ERD)
The client dream would be the conceptual model
Physical model
A design for an object (a car, a house, a database, etc) which includes implementation details such as size, volume, weight, etc)
The physical reality will become the physical model
All many-to-many relationships must be reduced to a set of on-t--many relationships

ERD Entity relationship diagram

An entity relationship diagram (ERD) is a consistent tool that can be used to represent the data requirements of a business regardless of type of database that is used, and even in the absence of one

Implementation-Free Models

  • A good conceptual data model stays the same regardless of the type of database the system is eventually built or implanted on, This is what is meant by saying the model is implementation-free
  • The data model should stay the same even if a database is not used at all

What is an Entity Relationship Model

  1. A list of entities and attributes as well as all relationships between the entities that are of importance
  2. Provided background information such as entity descriptions, data types, and constraints
  3. NOTE: The model does not require a diagram, but the diagram is typically a very useful tool

Goals of ER Modeling

  • Capture all required information
  • Ensure that information appears only once
  • Model no information that is derivable from other information already modeled
  • Locate information in a predictable, logical place

Database Normalization

Storing data in a normalized format means only one update is required to reflect the new address, and it should always be the one that appears whenever your mailing address is needed.

  1. Many people unfamiliar with database design principles often ask, “Why not just put all the data in one big table?” This single-table approach leads to problems of data redundancy (duplication) and data anomalies (data inconsistencies).
  2. To avoid these data issues, database normalization is used to create a design that reduces or eliminates data redundancy and, therefore, avoids data anomalies. In general, normalization helps database designers determine which attributes, or fields, belong to each entity. In turn, this information helps determine which fields belong in each table. Normalization is a multistage process that enables designers to take the raw data to be collected about an entity and develop the data into a structured, normalized form that reduces the risks associated with data redundancy. Data redundancy poses a special problem in databases because storing the same data in different places can cause problems when updates or changes to data are required.
  3. When a record contains repeating groups (that is, multiple entries for a single column), it’s considered unnormalized. First-normal form (1NF) indicates that all values of the columns are atomic—meaning they contain no repeating values. To convert records to 1NF, remove the repeating values by making each author entry a separate record,
  4. When more than one field is used as the primary key for a table, the combination of fields is usually referred to as a composite primary key

Now that the repeating values have been eliminated and the records can be identified uniquely, the data is in 1NF

A problem known as partial dependency can occur when the primary key consists of more than one field. Partial dependency means the fields contained in a record (row) depend on only one portion of the primary key

By removing Partial dependency your table is now second-normal-form (2NF)

A transitive dependency means at least one value in the record isn’t dependent on the primary key but on another field in the record. In this case, the contact person from the publisher’s office is actually dependent on the publisher, not on the book.

Levels of Normalization

  1. 1NF: Eliminate all repeating values and identify a primary key or primary composite key.
  2. 2NF: Make certain the table is in 1NF and eliminate any partial dependencies.
  3. 3NF: Make certain the table is in 2NF and remove any transitive dependencies.

A many-to-many relationship can’t exist in a relational database. The most common approach to eliminating a many-to-many relationship is to create two one-to-many relationships by adding a bridging entity. A bridging entity is placed between the original entities and serves as a “filter” for the data.

SQL Command Types

Query
SELECT(Retrieve the data values)
Data manipulation language (DML)
INSERT, UPDATE, DELETE (Create or modify data values)
Data definition language (DDL)
CREATE, ALTER, DROP (define data structures)
Transaction control (TC)
COMMIT, ROLLBACK (Save or undo data value modifications)
Data control language(DCL)
GRANT, REVOKE (Set permissions to access database structures)

Back To Top- Home - Category