1 / 7

Database Tables

Database Tables. 2914. two order-entry scenarios:. A customer wants to cancel an order that she's placed. If her address is in a separate table from her order, you can easily delete the order without deleting her address.

pascha
Download Presentation

Database Tables

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Database Tables 2914

  2. two order-entry scenarios: • A customer wants to cancel an order that she's placed. If her address is in a separate table from her order, you can easily delete the order without deleting her address. • Or you've just entered a pile of customer orders when your company changes its shipping methods. If the shipping methods are maintained in their own table, you don't have to update each individual order. Access works with separate tables in relational databases, which can help you structure data efficiently, avoid wasted effort, and reduce headaches. • Relational databases store data in separate tables, based on subject matter, but the tables are brought together through relationships. For example, a table of customers is related to a table of orders by a customer ID field in each of those tables. Typically, data should not be repeated in more than one table, except for such relating fields.

  3. Why separate tables? • Some benefits of this method are: • Efficiency    You don't have to store redundant information, such as a customer's name or address, in every order that the customer places. • Control    It's easier to update, delete, and extend data in a well-structured database that doesn't contain duplication. • Accuracy By avoiding repetition, you decrease the opportunity for errors. Right once, right everywhere. • Data integrity   You can add or remove fields or records in unique tables without affecting your data structure, and you will not need to redesign your database. Separation protects your original structure. As you plan your tables, think of ways to structure your data so that it's easy to enter and maintain. • Saved space.

  4. Structure your tables to avoid duplication • Here are some questions you can ask to help you better structure your data: • Is each record unique or is a record repeated somewhere else? • Are any details, or any groups of details, repeated in more than one record or table? • Can you easily make changes to one record without changing another record? • Does each record contain only the details that belong in that record, specifically appropriate to the record's identity? • Are any fields dependent on other fields in the table?

  5. Structure your tables to avoid duplication • If tables are not designed with the optimal structure, some relations will suffer from undesirable consequences: losing data, having to update data in multiple places, or being unable to add new data. • To see an example of how awkward organization can cause problems, consider the situation shown in the first table. • Suppose you want to change the details for Exotic Liquids in your database. If you store supplier information such as the address in each record in the Products table, you'll have to modify each record there. • By storing supplier information separately in its own Suppliers table, you can change the details just once, in that table. As the second table here shows, every product record that contains the Exotic Liquids Supplier ID number will refer to that updated information. Using the Supplier ID lets you remove supplier names and addresses from the Products table, avoiding duplicate information and a lot of unnecessary data maintenance. • Keep in mind: The more sense your tables make to you now, the more sense they will make to you later, and the easier they will be to use in powerful ways.

  6. Why separate tables?  The Suppliers table contains all the contact information about those businesses.  The Products table refers to the Suppliers table, but doesn't have to include all the suppliers'

  7. Structure your tables to avoid duplication • Redundant — supplier details included with each product. •  Efficient — supplier details in separate Suppliers table, with references from Products table.

More Related