The Database

Team-Fly    

Macromedia® DreamWeaver® MX Unleashed
By Matthew Pizzi, Zak Ruvalcaba
Table of Contents
Chapter 26.  Database Primer


Inside your DBMS are individual databases containing yet even more data related to a specific project. Although for most projects you would never need more than one database, you may in the future realize that your project has grown far beyond the scope of a single database that because of security or maintenance reasons, you require more. Figure 26.3 shows SQL Server Enterprise Manager with a list of the various databases that are housed within its framework.

Figure 26.3. SQL Server Enterprise Manager and a list of the databases that it contains.

graphics/26fig03.jpg

Tables

After a database has been created, just as it has been for the Web store, you might want to begin storing information that is relevant to a specific part of the Web store. As mentioned earlier, tables are very similar to file folders within a file cabinet's drawers. It would be a mistake to store all the information about inventory, product information, customers, and even transactions within one file folder; instead, you'll break these out, just as we did at the beginning of the chapter, and create different file folders or tables to store all the information.

Figure 26.4 shows the Web store database within the Enterprise Manager of SQL Server. By selecting and expanding the Web store database from the view in the left column, you can begin to see all the tables that can reside within the Web store.

Figure 26.4. Expanding the Web store database reveals all the tables associated with the project.

graphics/26fig04.jpg

Notice that there are more tables than just the four outlined in the beginning of the chapter. If you think in terms of space and redundancy, you will see exactly why you need to include more than just the four main tables. As far as the customers table is concerned, you could have a customer that has multiple credit cards on file hence the need for a separate credit card table. You could have a product that is available in numerous colors or, depending on what you sell, different formats and perhaps even sizes and makes.

TIP

The process of organizing data in an effort to avoid redundancy within tables is known as normalization and is discussed in depth toward the end of this chapter.


Before you begin any project, you will typically sketch all this out in an effort to reduce data duplication within your tables. Again, how you branch out your information and create tables depends on how big in scope your project is.

Columns

After you outline all your tables, the next step is to decide on what information will be included within those tables. For instance, you may want to include first name, last name, phone number, address, city, state, ZIP code, and so on for all your customers within the customers table. You may also need to include product names, descriptions, and some sort of unique identification within your products table. You may even want to combine certain aspects of certain tables and place them into the orders table, in which you would end up with information from the customers table as well as the orders table to come up with a final requisition.

Theoretically, columns represent bits of information or more detailed descriptions of the table that they are contained in. Just as you have a customers table, all customers must have names and physical addresses. Just as you have a products table, all products must have names and descriptions. Figure 26.5 shows what the customers table may look like after columns have been outlined.

Figure 26.5. The customers table displays all the columns that are associated with it.

graphics/26fig05.jpg

Rows

Think back to the example that I mentioned earlier regarding the documents within the folders and the folders within the drawers that are contained within the filing cabinet. Rows represent the actual data within those documents. Similar to the columns within the tables, rows represent the actual data within the columns. Suppose that this is a real Web store after people begin registering and purchasing items, the rows would expand and fill up with information as shown in Figure 26.6.

Figure 26.6. The customers table with multiple rows of information.

graphics/26fig06.jpg


    Team-Fly    
    Top


    Macromedia Dreamweaver MX Unleashed
    Macromedia Dreamweaver MX 2004 Unleashed
    ISBN: 0672326310
    EAN: 2147483647
    Year: 2002
    Pages: 321

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net