Designing a database is very easy to do, but hard to do well. There are many databases that have been built in the world that do not meet the needs of the applications they support.
The fundamentals of design are often not taught to developers or DBAs when they are given the task of building tables. Many people do not understand the logic used to decide what columns to use, the data types for each one, constraints between columns, and the keys that should be defined.
Joe Celko, widely viewed as an expert in the SQL language, brings us a series that looks to help you understand the fundamentals of the design process. The articles in the series are linked below:
Stairway to Database Design - STEP 1: Data Elements - Before you start to think about your database schema or tables, you need to consider your data: The type of data it is, the scale you use for values. It needs to be unique, precise and unambiguous. Then you need to name it in such a way that it can be generally understood. Joe Celko explains.
Stairway to Database Design: STEP 2: Domains, Constraints and Defaults - A clear understanding of SQL Data Types and domains is a fundamental requirement for the Database Developer, but it is not elementary. If you select the most appropriate data type, it can sidestep a variety of errors. Furthermore, if you then define the data domains as exactly as possible via constraints, you can catch a variety of those problems that would otherwise bedevil the work of the application programmer.
Stairway to Database Design STEP 3: Building Tables - There are several types of tables, each with their special requirements for rules and integrity constraints. Whatever the requirement, table-level constraints will ensure that the rules are enforced and data integrity is maintained.
Stairway to Database Design STEP 4: Building a Schema - Having described tables, Joe Celko explains how to make them work together as a database and touches on what entity relationships and Views are
Stairway to Database Design - STEP 5: Procedures - Joe Celko tackles the subject of the Stored Procedure and its place in database design. What he writes is food for thought, even for experienced database developers.
Stairway to Database Design STEP 6: Procedure Bodies - Having covered the procedure headers in SQL Server in the previous step, Joe tackles the subject of the contents of stored procedures. In this step, he outlines limitations of TSQL as a procedural language, and what you need to bear in mind when deciding how to use them.
Stairway to Database Design STEP 7: Triggers - In steps one to four, we built the tables, base and virtual, of a schema. Steps five and six dealt with stored procedures. This step deals with a feature you need to avoid as much as possible. This is article is on Triggers.