Conceptual database design components .
reEntity objects for which the data is collected, like humans, a real physical object or just a concept.
Example: the creation of individual entities Enternal Entity: an entity that dihunakan for exchanging data, but not stored in the database Attribute: unit facts about kira0kira specific entity. Relationship: an association / association between entities Business rule: policies, or procedures that organizations use the following standards and defining certain control over dat, n is often implemented in a database as a compositiolationship
Maximum cardinality : bilangan maksimum , contoh satu entity boleh dikaitkan
Transferable : relationships may be transferred if the parents which may change from time to time.
Conditional in one direction : means that a corresponding record may or not be found on the optional side of the relationship
Conditional in both direction: means that corresponding record may or not be found on the optional side of the relationship
Mandatory in one direction: means that a corresponding must exist on the mandatory side of the relationship
Mandatory in both directions: : means that corresponding record must be found on both sides of the relationship
One-to-many: indicates that are record in one table may be related to many (usually0+) records in another table.
Many-to-many: this can be thought of as one-to-many relationship that goes in both directions; many-to-many relationships are not natively supported in relational databases, but there are ways to convert them into something that can be handled.
Intersection data: data that is associated with two related entities in a many-to-many relationship, and which only makes sense when associated with both related entities; intersection data can beplaced (mapped) into a separate table to help relational databases handle the many –to-many relationship
Recursive: refers to relationships between instances of the same entity type
ENTITY-RELATIONSHIP DIAGRAMS
Graphical data model
Entities are represented by rectangles
Unique identifier (primary key) located in rectangle at top of the entity rectangle it is a unique identifier for
EMPLOYEE ID
Last Name
FirstName
HourlyRate
Position
Logical database design components
· Table: a 2-D logical structure like a grid where each row contains attributes about a single instance of the entity type the table represents , and each column represents a particular attribute
o Entities are sometimes split into two tables
o Different entities are sometimes merged into a single table (rare)
o Entities are usually named using a plural , while tables are named in the
Column: the smallest named unit of data in a database
· Columns must be given a data type.
· Data types help the database store data efficiently
· Data type restrict attribute values to the correct data type and provides a set of behaviors consistent with the specified data type (such as addition, subtraction. Etc. for numbers
· Unfortunately, different vendors support differing zoos of data types.
Constraints: rules that restrictallowable data values
Primary key: one or more colums that uniquely identify a particular row in a table
Ø The constraint is that duplicate values are not allowed in the primary key column(s) of a table
Ø Primary keys are usually implemented as an index
Ø An index speeds up searches
· Foreign key: afield on the many-side side of a one-to-many relationship that uniquely identifies one row in another table (usually by using the primary key in the latter table)
· Referential constraints:
Ø Can check for parent record when inserting new child record (using the child record’s foreign key to check for a matching parent record
Ø Don’t allow modification of child record’s foreign key if the new value is not reprensented by an istance in the parent table
Ø Can delete all matching child records when a parent tecord is deleted
· Integrity constraints: used to make sure field (atrtribute) values that are invalid are not allowed
Ø May check for a range of values, or specific valid values
Ø May check for NOT NULL
· TRIGGERS: A TRIGGER IS APROGRAM STORED IN THE DATABASE THAT RUNS WHEN A SPECIFIC EVENT HAPPENS. Triggers can be used to validate data (among other things).
Surrogate key: a key used to replace what would be the natural key for an entity
Views : refers to the way different esers may see the same database differently
· Views are stored queries (virtual tables)
· Views can hide colums (cleaner , more secure)
· Views can hide tables (cleaner, more secure)
· Views can hide complex operations such as joins
· Views may improve query performance
No comments:
Post a Comment