• Like
  • Save
Relational Databases
Upcoming SlideShare
Loading in...5
×
 

Relational Databases

on

  • 889 views

 

Statistics

Views

Total Views
889
Views on SlideShare
889
Embed Views
0

Actions

Likes
1
Downloads
51
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Relational Databases Relational Databases Presentation Transcript

    • Introduction to Relational Databases 1
    • Relational Databases
      • As information needs grow and become more complex, so to do methods of storing, managing and retrieving the data.
      • Database systems evolved to manage this information and data.
    • Relational Databases
      • The relational model was developed in 1970 by E.F. Codd
      • The basic data components in a relational database are "entities" and their "attributes" and the basic logical structure is a "table".
    • Components
      • Entities
        • A "thing" in a real world with an independent existence. Something about which you want to store data typically: a person, place, object, concept, or event.
    • Components
      • Attributes
        • A characteristic of an entity or object. A detailed piece of information that describes an entity.
      • Tables
        • Each table is a separate and independent unit - although tables may be related
    • The Relational Database Model
      • The simplest model for a database is a flat file.
      • You have only a single table which includes fields for each element you need to store.
      • The problem with flat files is that they waste storage space and are problematic to maintain.
    • Flat Files
      • Data redundancy
        • storing the same information in more than one file.
          • E.g. a customers address stored in more than one file.
      • Data integrity
        • maintaining accurate data. If a customer’s address is changed will it be changed in all files? If not the data loses it’s integrity - it is inaccurate.
    • Example Customers Customer Number Company Name Address City, State, Phone Number Orders Order Number Order Date Order Line Items Item Number Description Quantity Price Each time an order is placed, you'll need to repeat the customer information, including the Customer Number, Company Name, etc. A company which takes orders from many customers
    • Solution
      • The solution to this problem is to use a relational model for the data.
      • This means that in this example each order entered is related to a customer record, and each line item is related to an order record.
    • Solution
      • A relational database management system (RDBMS) is a piece of software that manages groups of records which are related to one another.
    • Solution Customers CustID CustName CustAddress CustCity CustState CustPhone Orders OrdID OrdCustID OrdDate OrderDetails ODID ODOrdID ODDescription ODQty ODPrice
    • Advantages of a RDMS
      • All data is stored in the database
      • Data redundancy is reduced
      • Easier to maintain data integrity
      • Eliminates the dependence between programs and data.
        • The database can operate as a stand alone application.
    • Keys
      • A key is simply a field which can be used to identify a record.
      • Primary key
        • A primary key is a field that uniquely identifies a record in a table.
        • No two records can have the same value for a primary key.
    • Keys
      • Foreign Key
        • A foreign key represents the value of primary key for a related table.
        • Foreign keys are the cornerstone of relational databases.
    • Example In the Customers Table, the CustID field will contain the data to uniquely identify a customer. This is the primary key. In the Orders table, the OrdCustID field would hold the value of the CustID field for the customer who placed the order. This makes OrdCustID a foreign key
    • Solution Customers CustID CustName CustAddress CustCity CustState CustPhone Orders OrdID OrdCustID OrdDate OrderDetails ODID ODOrdID ODDescription ODQty ODPrice In the Orders table, the OrdCustID field would hold the value of the CustID field for the customer who placed the order. Primary Keys Foreign Keys
    • Referential Integrity
      • This is a validity check
        • a set of rules that avoids data inconsistency.
      • This means that a foreign key cannot be entered into one table unless it matches a primary key in another
      • Referential integrity can also prevent the deletion of a record if the record has a primary key that matches foreign keys in another table.