Skip to content Skip to sidebar Skip to footer

to determine the best way to organize a database what must you understand

A properly designed database provides y'all with access to up-to-date, accurate information. Because a correct pattern is essential to achieving your goals in working with a database, investing the time required to learn the principles of good pattern makes sense. In the end, you are much more likely to finish upward with a database that meets your needs and can hands adjust modify.

This commodity provides guidelines for planning a desktop database. You will acquire how to decide what information you need, how to divide that information into the appropriate tables and columns, and how those tables relate to each other. You should read this commodity before yous create your first desktop database.

Important: Access provides pattern experiences that permit you create database applications for the Web. Many design considerations are unlike when you design for the Web. This commodity doesn't talk over Web database application design. For more than data, see the article Build a database to share on the Web.

In this article

  • Some database terms to know

  • What is good database blueprint?

  • The pattern procedure

  • Determining the purpose of your database

  • Finding and organizing the required information

  • Dividing the information into tables

  • Turning information items into columns

  • Specifying primary keys

  • Creating the table relationships

  • Refining the design

  • Applying the normalization rules

Some database terms to know

Access organizes your information into tables: lists of rows and columns reminiscent of an accountant'south pad or a spreadsheet. In a simple database, y'all might have only one tabular array. For most databases you will need more than than ane. For example, y'all might have a table that stores information about products, another table that stores information nigh orders, and some other table with information about customers.

Image depicting three tables in datasheets

Each row is more correctly called a record, and each column, a field. A record is a meaningful and consistent style to combine information about something. A field is a single detail of data — an item blazon that appears in every record. In the Products table, for instance, each row or tape would hold information near one product. Each column or field holds some type of information almost that product, such equally its name or price.

Top of Folio

What is good database design?

Sure principles guide the database design process. The first principle is that duplicate data (too called redundant data) is bad, because it wastes infinite and increases the likelihood of errors and inconsistencies. The second principle is that the correctness and completeness of information is of import. If your database contains incorrect information, any reports that pull information from the database will also contain incorrect data. As a result, whatsoever decisions you brand that are based on those reports will then be misinformed.

A skillful database design is, therefore, one that:

  • Divides your data into subject-based tables to reduce redundant information.

  • Provides Admission with the information it requires to join the data in the tables together as needed.

  • Helps back up and ensure the accuracy and integrity of your information.

  • Accommodates your data processing and reporting needs.

Tiptop of Page

The design process

The pattern procedure consists of the following steps:

  • Determine the purpose of your database

    This helps prepare you for the remaining steps.

  • Observe and organize the information required

    Get together all of the types of information you might want to record in the database, such every bit product name and order number.

  • Dissever the information into tables

    Split your information items into major entities or subjects, such as Products or Orders. Each subject then becomes a table.

  • Turn information items into columns

    Determine what information you want to store in each table. Each detail becomes a field, and is displayed as a cavalcade in the table. For example, an Employees tabular array might include fields such as Last Name and Hire Date.

  • Specify primary keys

    Cull each table'due south primary key. The main key is a column that is used to uniquely place each row. An instance might be Product ID or Order ID.

  • Gear up the table relationships

    Await at each table and make up one's mind how the data in one table is related to the data in other tables. Add fields to tables or create new tables to clarify the relationships, as necessary.

  • Refine your design

    Analyze your pattern for errors. Create the tables and add a few records of sample information. See if you can get the results yous want from your tables. Make adjustments to the design, as needed.

  • Apply the normalization rules

    Apply the information normalization rules to see if your tables are structured correctly. Brand adjustments to the tables, as needed.

Top of Folio

Determining the purpose of your database

It is a skilful idea to write downwards the purpose of the database on newspaper — its purpose, how you look to use it, and who volition use it. For a small database for a domicile based business, for case, you lot might write something uncomplicated like "The customer database keeps a list of customer information for the purpose of producing mailings and reports." If the database is more than complex or is used by many people, as often occurs in a corporate setting, the purpose could easily be a paragraph or more than and should include when and how each person will use the database. The idea is to have a well adult mission argument that can be referred to throughout the design procedure. Having such a argument helps yous focus on your goals when you make decisions.

Top of Folio

Finding and organizing the required information

To find and organize the data required, showtime with your existing information. For example, you might record purchase orders in a ledger or proceed customer data on paper forms in a file chiffonier. Gather those documents and list each type of information shown (for example, each box that y'all fill in on a form). If you don't have any existing forms, imagine instead that you have to pattern a form to record the customer information. What data would you lot put on the form? What make full-in boxes would you create? Identify and list each of these items. For instance, suppose y'all currently go along the customer list on index cards. Examining these cards might show that each card holds a customers proper name, accost, city, state, postal code and phone number. Each of these items represents a potential column in a tabular array.

Equally yous prepare this listing, don't worry about getting information technology perfect at first. Instead, list each item that comes to mind. If someone else will exist using the database, ask for their ideas, likewise. Y'all can fine-melody the listing later.

Next, consider the types of reports or mailings you might want to produce from the database. For case, you might want a product sales written report to evidence sales by region, or an inventory summary report that shows production inventory levels. You might also want to generate class messages to send to customers that announces a auction event or offers a premium. Design the study in your heed, and imagine what it would look like. What information would you place on the report? List each detail. Do the same for the form letter of the alphabet and for whatsoever other report you conceptualize creating.

a person imagining a product inventory report

Giving idea to the reports and mailings you might want to create helps you place items you volition need in your database. For example, suppose you give customers the opportunity to opt in to (or out of) periodic e-post updates, and you want to impress a list of those who have opted in. To tape that information, you add together a "Send e-post" column to the client table. For each customer, yous can set the field to Yep or No.

The requirement to send email messages to customers suggests another item to record. Once yous know that a client wants to receive eastward-postal service messages, you will also need to know the electronic mail address to which to transport them. Therefore you need to record an email address for each customer.

It makes skillful sense to construct a prototype of each report or output listing and consider what items y'all will need to produce the study. For instance, when you examine a form letter, a few things might come to mind. If you desire to include a proper salutation — for example, the "Mr.", "Mrs." or "Ms." string that starts a greeting, y'all will take to create a salutation item. Also, you lot might typically start a letter with "Honey Mr. Smith", rather than "Beloved. Mr. Sylvester Smith". This suggests you would typically want to store the last name separate from the first name.

A key betoken to remember is that you should suspension each slice of information into its smallest useful parts. In the instance of a name, to make the last name readily bachelor, yous will pause the name into two parts — Kickoff Name and Last Name. To sort a report by last proper name, for example, information technology helps to have the customer's final proper name stored separately. In full general, if yous desire to sort, search, summate, or report based on an detail of data, you lot should put that item in its own field.

Remember about the questions yous might desire the database to answer. For instance, how many sales of your featured product did you close last calendar month? Where practise your best customers live? Who is the supplier for your best-selling product? Anticipating these questions helps you lot zero in on additional items to record.

After gathering this information, you are ready for the next stride.

Top of Folio

Dividing the data into tables

To divide the information into tables, cull the major entities, or subjects. For example, after finding and organizing information for a product sales database, the preliminary listing might look like this:

Handwritten information items grouped into subjects

The major entities shown here are the products, the suppliers, the customers, and the orders. Therefore, it makes sense to start out with these four tables: i for facts nearly products, one for facts about suppliers, one for facts about customers, and one for facts about orders. Although this doesn't complete the list, it is a good starting point. You can continue to refine this list until you have a blueprint that works well.

When you first review the preliminary list of items, you might be tempted to place them all in a single table, instead of the four shown in the preceding illustration. Yous will learn here why that is a bad idea. Consider for a moment, the table shown here:

Image showing table that contains both products and suppliers

In this case, each row contains data about both the product and its supplier. Because you can have many products from the same supplier, the supplier name and accost information has to be repeated many times. This wastes deejay space. Recording the supplier information only once in a divide Suppliers tabular array, and then linking that table to the Products table, is a much better solution.

A second problem with this design comes about when you demand to modify information about the supplier. For case, suppose you need to modify a supplier'due south accost. Because information technology appears in many places, you lot might accidentally change the address in one place but forget to change it in the others. Recording the supplier'south accost in only i place solves the problem.

When you lot blueprint your database, always try to record each fact just once. If yous observe yourself repeating the same information in more one place, such as the address for a detail supplier, place that information in a carve up table.

Finally, suppose in that location is only i product supplied past Coho Winery, and you lot desire to delete the product, but retain the supplier proper noun and address information. How would you delete the production record without also losing the supplier information? You tin't. Considering each tape contains facts about a product, equally well as facts virtually a supplier, you cannot delete one without deleting the other. To keep these facts separate, yous must split the 1 table into two: one table for production information, and some other tabular array for supplier information. Deleting a production record should delete merely the facts most the product, not the facts most the supplier.

Once you accept chosen the bailiwick that is represented by a table, columns in that table should store facts only about the field of study. For case, the product table should shop facts but well-nigh products. Because the supplier address is a fact almost the supplier, and not a fact near the production, it belongs in the supplier table.

Top of Folio

Turning information items into columns

To decide the columns in a tabular array, decide what information y'all demand to track about the subject recorded in the table. For example, for the Customers table, Name, Address, Urban center-State-Goose egg, Ship e-mail, Salutation and Email address comprise a good starting list of columns. Each record in the table contains the same ready of columns, then yous can shop Name, Address, Metropolis-Country-Zip, Transport e-postal service, Salutation and East-mail accost information for each tape. For example, the accost column contains customers' addresses. Each record contains data near one customer, and the address field contains the address for that customer.

Once you have determined the initial set of columns for each table, y'all tin further refine the columns. For case, it makes sense to shop the customer proper noun every bit two split columns: first name and final name, so that you can sort, search, and index on just those columns. Similarly, the address actually consists of 5 separate components, address, urban center, land, postal code, and country/region, and it also makes sense to store them in separate columns. If you desire to perform a search, filter or sort operation by state, for example, you need the state information stored in a split cavalcade.

You lot should likewise consider whether the database will hold information that is of domestic origin only, or international, as well. For instance, if you plan to store international addresses, it is better to take a Region cavalcade instead of State, considering such a column can adapt both domestic states and the regions of other countries/regions. Similarly, Postal Code makes more sense than Zip Lawmaking if you are going to shop international addresses.

The following list shows a few tips for determining your columns.

  • Don't include calculated data

    In most cases, you lot should not store the result of calculations in tables. Instead, y'all can have Admission perform the calculations when yous want to come across the result. For case, suppose in that location is a Products On Order report that displays the subtotal of units on lodge for each category of product in the database. However, there is no Units On Society subtotal cavalcade in whatever table. Instead, the Products table includes a Units On Order column that stores the units on order for each product. Using that information, Access calculates the subtotal each time y'all print the report. The subtotal itself should non be stored in a tabular array.

  • Store information in its smallest logical parts

    You lot may be tempted to have a single field for full names, or for production names along with product descriptions. If y'all combine more than one kind of data in a field, it is difficult to call up individual facts later. Try to break downwardly data into logical parts; for case, create carve up fields for get-go and last name, or for product proper noun, category, and clarification.

Image showing information items during design process

One time you take refined the data columns in each table, you lot are ready to cull each table's primary key.

Top of Page

Specifying principal keys

Each table should include a cavalcade or gear up of columns that uniquely identifies each row stored in the table. This is often a unique identification number, such as an employee ID number or a series number. In database terminology, this data is called the chief key of the table. Access uses primary cardinal fields to quickly associate data from multiple tables and bring the information together for yous.

If you already have a unique identifier for a table, such every bit a production number that uniquely identifies each production in your catalog, you tin employ that identifier as the tabular array's principal central — simply simply if the values in this column will always exist different for each tape. Y'all cannot have indistinguishable values in a principal fundamental. For example, don't utilize people'southward names as a primary key, because names are non unique. You could easily have two people with the same proper noun in the same table.

A primary key must always have a value. If a cavalcade's value can become unassigned or unknown (a missing value) at some betoken, it tin can't exist used equally a component in a primary central.

Y'all should e'er choose a primary fundamental whose value will not change. In a database that uses more than ane table, a tabular array's chief key can be used as a reference in other tables. If the primary primal changes, the change must also be applied everywhere the primal is referenced. Using a principal cardinal that will not change reduces the take a chance that the primary primal might become out of sync with other tables that reference it.

Frequently, an arbitrary unique number is used as the master key. For example, you might assign each order a unique order number. The order number's but purpose is to identify an gild. Once assigned, it never changes.

If you don't have in mind a column or set of columns that might make a skilful primary key, consider using a cavalcade that has the AutoNumber data type. When you employ the AutoNumber data type, Admission automatically assigns a value for you. Such an identifier is factless; information technology contains no factual information describing the row that information technology represents. Factless identifiers are ideal for use every bit a main key because they practise non alter. A principal key that contains facts about a row — a phone number or a customer proper noun, for example — is more likely to alter, because the factual information itself might change.

Image showing Products table with primary key field.

1. A column set to the AutoNumber data type oft makes a good principal central. No 2 product IDs are the same.

In some cases, you may desire to employ ii or more than fields that, together, provide the primary key of a tabular array. For example, an Society Details tabular array that stores line items for orders would use two columns in its primary key: Order ID and Product ID. When a primary central employs more than ane column, it is also chosen a blended key.

For the product sales database, you can create an AutoNumber column for each of the tables to serve as primary key: ProductID for the Products table, OrderID for the Orders table, CustomerID for the Customers table, and SupplierID for the Suppliers tabular array.

Image showing information items during design process

Meridian of Page

Creating the table relationships

At present that y'all take divided your information into tables, you demand a way to bring the information together once again in meaningful means. For instance, the post-obit form includes data from several tables.

Image of orders form

1. Information in this form comes from the Customers tabular array...

two. ...the Employees table...

3. ...the Orders tabular array...

iv. ...the Products table...

5. ...and the Gild Details tabular array.

Access is a relational database management system. In a relational database, yous divide your data into separate, subject area-based tables. Y'all so apply table relationships to bring the information together as needed.

Meridian of Page

Creating a i-to-many relationship

Consider this example: the Suppliers and Products tables in the production orders database. A supplier can supply whatsoever number of products. It follows that for whatever supplier represented in the Suppliers table, there can exist many products represented in the Products table. The human relationship between the Suppliers table and the Products table is, therefore, a one-to-many relationship.

One to many conceptual

To represent a one-to-many relationship in your database design, accept the primary key on the "i" side of the relationship and add it as an additional column or columns to the table on the "many" side of the relationship. In this case, for case, you add the Supplier ID column from the Suppliers tabular array to the Products table. Access can then utilize the supplier ID number in the Products table to locate the correct supplier for each production.

The Supplier ID column in the Products table is called a foreign key. A foreign primal is another tabular array's primary fundamental. The Supplier ID column in the Products table is a foreign key because it is also the primary cardinal in the Suppliers table.

Image showing information items during design process

Y'all provide the footing for joining related tables by establishing pairings of primary keys and foreign keys. If you are not certain which tables should share a common column, identifying a ane-to-many relationship ensures that the two tables involved will, indeed, require a shared cavalcade.

Summit of Folio

Creating a many-to-many relationship

Consider the relationship betwixt the Products table and Orders table.

A unmarried order can include more than ane production. On the other hand, a unmarried product can appear on many orders. Therefore, for each record in the Orders table, there can exist many records in the Products table. And for each record in the Products tabular array, in that location can be many records in the Orders table. This type of relationship is called a many-to-many relationship because for any product, in that location can be many orders; and for whatever club, there tin can be many products. Note that to notice many-to-many relationships between your tables, information technology is important that you consider both sides of the relationship.

The subjects of the two tables — orders and products — accept a many-to-many relationship. This presents a problem. To empathize the problem, imagine what would happen if you tried to create the relationship betwixt the two tables by adding the Production ID field to the Orders tabular array. To have more than ane product per guild, y'all demand more than i record in the Orders table per lodge. You would be repeating order information for each row that relates to a single order — resulting in an inefficient design that could lead to inaccurate data. You run across the same problem if y'all put the Order ID field in the Products table — y'all would have more than than one record in the Products table for each product. How exercise you solve this trouble?

The reply is to create a third tabular array, ofttimes called a junction table, that breaks downwardly the many-to-many relationship into 2 i-to-many relationships. You insert the master key from each of the 2 tables into the third table. As a result, the third table records each occurrence or instance of the relationship.

Conceptual of a many to many relationship

Each record in the Lodge Details tabular array represents one line particular on an social club. The Lodge Details tabular array'southward chief key consists of two fields — the strange keys from the Orders and the Products tables. Using the Social club ID field alone doesn't piece of work as the primary primal for this table, because one order tin can have many line items. The Club ID is repeated for each line particular on an order, then the field doesn't contain unique values. Using the Product ID field lone doesn't work either, considering one product tin announced on many different orders. But together, the ii fields always produce a unique value for each record.

In the product sales database, the Orders table and the Products table are not related to each other directly. Instead, they are related indirectly through the Order Details table. The many-to-many human relationship between orders and products is represented in the database by using two one-to-many relationships:

  • The Orders table and Order Details table have a one-to-many human relationship. Each club can have more than ane line item, but each line item is connected to only one order.

  • The Products tabular array and Order Details table have a i-to-many relationship. Each production can have many line items associated with it, merely each line detail refers to simply i product.

From the Society Details table, you tin can determine all of the products on a particular order. You can also determine all of the orders for a particular product.

Afterward incorporating the Order Details table, the list of tables and fields might await something like this:

Image showing information items during design process

Peak of Page

Creating a one-to-one relationship

Some other type of human relationship is the one-to-one relationship. For case, suppose you need to record some special supplementary product data that you will need rarely or that simply applies to a few products. Because you lot don't need the information often, and because storing the information in the Products tabular array would issue in empty infinite for every product to which it doesn't employ, you identify it in a separate table. Like the Products tabular array, you utilize the ProductID equally the primary key. The relationship between this supplemental tabular array and the Product table is a one-to-one human relationship. For each record in the Production table, there exists a unmarried matching record in the supplemental table. When you do identify such a relationship, both tables must share a common field.

When you lot observe the need for a 1-to-one relationship in your database, consider whether you can put the information from the two tables together in one tabular array. If yous don't want to do that for some reason, mayhap because it would outcome in a lot of empty space, the following list shows how you would correspond the human relationship in your design:

  • If the two tables have the same subject, you can probably set upward the relationship by using the same primary key in both tables.

  • If the two tables have different subjects with different main keys, choose one of the tables (either i) and insert its primary key in the other table as a strange cardinal.

Determining the relationships between tables helps you ensure that you have the right tables and columns. When a one-to-i or one-to-many relationship exists, the tables involved need to share a common column or columns. When a many-to-many relationship exists, a tertiary table is needed to represent the relationship.

Top of Page

Refining the design

Once yous have the tables, fields, and relationships you need, you should create and populate your tables with sample data and endeavor working with the information: creating queries, calculation new records, then on. Doing this helps highlight potential problems — for instance, you might need to add a column that you lot forgot to insert during your design stage, or y'all may accept a table that you should split into ii tables to remove duplication.

Run into if you can utilise the database to get the answers you want. Create rough drafts of your forms and reports and see if they show the data you expect. Wait for unnecessary duplication of information and, when you find any, alter your design to eliminate it.

Equally you effort out your initial database, you will probably discover room for improvement. Here are a few things to check for:

  • Did you forget whatsoever columns? If then, does the information belong in the existing tables? If it is data about something else, you may need to create another table. Create a column for every information item you lot need to track. If the information tin can't exist calculated from other columns, it is likely that y'all will need a new column for it.

  • Are whatsoever columns unnecessary because they can exist calculated from existing fields? If an information detail tin can be calculated from other existing columns — a discounted price calculated from the retail price, for example — it is commonly better to practise only that, and avoid creating new column.

  • Are you repeatedly entering duplicate data in one of your tables? If and then, yous probably need to split up the table into two tables that have a one-to-many relationship.

  • Do you accept tables with many fields, a express number of records, and many empty fields in individual records? If then, think about redesigning the table then it has fewer fields and more than records.

  • Has each data item been broken into its smallest useful parts? If you need to study, sort, search, or summate on an particular of information, put that item in its own column.

  • Does each column comprise a fact about the table'southward subject? If a column does not contain information about the table's discipline, it belongs in a different table.

  • Are all relationships between tables represented, either by common fields or past a 3rd table? One-to-one and one-to- many relationships require common columns. Many-to-many relationships require a third table.

Refining the Products table

Suppose that each product in the production sales database falls under a general category, such as beverages, condiments, or seafood. The Products tabular array could include a field that shows the category of each product.

Suppose that later examining and refining the design of the database, you lot decide to store a description of the category forth with its name. If you add a Category Clarification field to the Products table, you have to repeat each category clarification for each product that falls under the category — this is not a good solution.

A ameliorate solution is to brand Categories a new discipline for the database to track, with its ain table and its ain primary cardinal. You can then add the primary central from the Categories table to the Products table as a foreign key.

The Categories and Products tables have a one-to-many relationship: a category tin include more than ane product, but a product tin vest to simply one category.

When yous review your table structures, be on the lookout for repeating groups. For instance, consider a table containing the post-obit columns:

  • Production ID

  • Name

  • Production ID1

  • Name1

  • Production ID2

  • Name2

  • Product ID3

  • Name3

Here, each production is a repeating group of columns that differs from the others but past adding a number to the end of the column name. When yous run into columns numbered this way, you should revisit your design.

Such a design has several flaws. For starters, it forces you to place an upper limit on the number of products. As before long as you exceed that limit, you lot must add together a new group of columns to the table structure, which is a major administrative job.

Another problem is that those suppliers that accept fewer than the maximum number of products will waste some infinite, since the additional columns will be blank. The most serious flaw with such a design is that information technology makes many tasks difficult to perform, such equally sorting or indexing the table by production ID or name.

Whenever you see repeating groups review the design closely with an eye on splitting the table in ii. In the above instance it is meliorate to use two tables, one for suppliers and one for products, linked by supplier ID.

Top of Page

Applying the normalization rules

You can utilize the data normalization rules (sometimes just called normalization rules) as the next step in your design. You use these rules to see if your tables are structured correctly. The process of applying the rules to your database design is called normalizing the database, or simply normalization.

Normalization is nigh useful after you have represented all of the information items and take arrived at a preliminary design. The idea is to help you ensure that you have divided your information items into the advisable tables. What normalization cannot practise is ensure that you lot have all the right data items to brainstorm with.

You utilise the rules in succession, at each step ensuring that your design arrives at one of what is known every bit the "normal forms." Five normal forms are widely accepted — the first normal form through the fifth normal form. This commodity expands on the outset iii, because they are all that is required for the majority of database designs.

First normal form

Offset normal course states that at every row and cavalcade intersection in the tabular array there, exists a single value, and never a listing of values. For example, yous cannot have a field named Price in which you place more than than one Price. If you recall of each intersection of rows and columns every bit a cell, each cell tin can concur simply one value.

Second normal form

Second normal form requires that each non-key column be fully dependent on the entire primary key, not on but part of the cardinal. This rule applies when you have a primary key that consists of more than one column. For example, suppose y'all accept a table containing the post-obit columns, where Order ID and Product ID form the principal primal:

  • Social club ID (master key)

  • Production ID (primary cardinal)

  • Product Proper name

This design violates 2nd normal form, considering Product Name is dependent on Product ID, but not on Order ID, so information technology is not dependent on the entire master cardinal. You must remove Product Name from the table. Information technology belongs in a dissimilar table (Products).

Third normal form

Third normal form requires that not only every non-cardinal column be dependent on the entire primary fundamental, only that not-key columns be independent of each other.

Another way of saying this is that each not-key column must be dependent on the chief key and nothing but the master fundamental. For example, suppose you take a tabular array containing the post-obit columns:

  • ProductID (chief key)

  • Name

  • SRP

  • Discount

Presume that Discount depends on the suggested retail price (SRP). This table violates third normal form because a non-key cavalcade, Discount, depends on another non-key column, SRP. Column independence means that yous should be able to alter whatever not-central column without affecting whatsoever other column. If you change a value in the SRP field, the Discount would change accordingly, thus violating that dominion. In this instance Discount should be moved to some other table that is keyed on SRP.

Pinnacle of Page

rothupcome1988.blogspot.com

Source: https://support.microsoft.com/en-us/office/database-design-basics-eb2159cf-1e30-401a-8084-bd4f9c9ca1f5

Postar um comentário for "to determine the best way to organize a database what must you understand"