How to Design a Web Page Database
When creating a dynamic website, a database is an important tool to save data and display information to the user. Designing a database for a web page or website is a major part of its creation. A poor database design can cause pages to be slow, or they can cause errors and data loss. Several rules apply when creating a good database design.
Instructions
-
-
1
Create organized tables that contain the data fields. For instance, if you have a website that holds customer information, you can create tables such as a customer and order tables.
-
2
Create columns in each table. For instance, the customer database needs details like first name, last name and address. For each record created from the web page, the column is used to define the data. Table columns should be well-defined and abbreviations should be avoided. Well-defined columns help assist other programmers troubleshoot and understand the database layout.
-
-
3
Create relationships between the different tables. These are accomplished using primary and foreign keys. For instance, a customer ID is a unique number in a table. It can be used as the primary key for the customer table. Since a customer has orders, the foreign key is in the order table. Most databases provide a drag-and-drop procedure where you drag the primary key field to the foreign key table and the relationship is automatically created.
-
4
Define security by creating a username specifically for the web page. Instead of having several different users connect to the database, create one user who is always used from the web page to attach to the database. The user created should have limited permissions on the database. Only provide insert, select and update permissions to prevent unscrupulous hackers from deleting records.
-
1