拿一张大桌子把它分成小块和小块。更容易维护表?

时间:2011-07-07 21:09:36

标签: sql sql-server-2008

我有这个大型数据库表跟踪(目前正在制作中),人员医疗证明:日期到期(exp),公司,如果我们将其存档和数字副本的位置。我们跟踪许多(不断增长的)类别,如心肺复苏术,心肺复苏术,AED,救生员等......

如何让这更容易管理以及如何迁移现有数据?我是运行SQL Server 2008的coldfusion web应用程序。

CREATE TABLE [dbo].[mod_StudentCertifications](
    [certificationID] [int] IDENTITY(1,1) NOT NULL,
    [profileID] [int] NOT NULL,
    [cprAdultExp] [datetime] NULL,
    [cprAdultcompany] [nvarchar](250) NULL,
    [cprAdultImage] [nvarchar](4000) NULL,
    [cprAdultOnFile] [bit] NULL,
    [cprInfantChildExp] [datetime] NULL,
    [cprInfantChildcompany] [nvarchar](250) NULL,
    [cprInfantChildImage] [nvarchar](4000) NULL,
    [cprInfantChildOnFile] [bit] NULL,
    [cprFPRExp] [datetime] NULL,
    [cprFPRcompany] [nvarchar](250) NULL,
    [cprFPRImage] [nvarchar](4000) NULL,
    [cprFPROnFile] [bit] NULL,
    [aedExp] [datetime] NULL,
    [aedcompany] [nvarchar](250) NULL,
    [aedImage] [nvarchar](4000) NULL,
    [aedOnFile] [bit] NULL,
    [firstAidExp] [datetime] NULL,
    [firstAidcompany] [nvarchar](250) NULL,
    [firstAidImage] [nvarchar](4000) NULL,
    [firstAidOnFile] [bit] NULL,
    [emtExp] [datetime] NULL,
    [emtcompany] [nvarchar](250) NULL,
    [emtImage] [nvarchar](4000) NULL,
    [emtOnFile] [bit] NULL,
    [waterSafetyInstructionExp] [datetime] NULL,
    [waterSafetyInstructioncompany] [nvarchar](250) NULL,
    [waterSafetyInstructionImage] [nvarchar](4000) NULL,
    [waterSafetyInstructionOnFile] [bit] NULL,
    [bloodPathogensExp] [datetime] NULL,
    [bloodPathogenscompany] [nvarchar](250) NULL,
    [bloodPathogensImage] [nvarchar](4000) NULL,
    [bloodPathogensOnFile] [bit] NULL,
    [oxygenAdminExp] [datetime] NULL,
    [oxygenAdmincompany] [nvarchar](250) NULL,
    [oxygenAdminImage] [nvarchar](4000) NULL,
    [oxygenAdminOnFile] [bit] NULL,
    [lifegaurdingExp] [datetime] NULL,
    [lifegaurdingcompany] [nvarchar](250) NULL,
    [lifegaurdingImage] [nvarchar](4000) NULL,
    [lifegaurdingOnFile] [bit] NULL,
    [wildernessResponderExp] [datetime] NULL,
    [wildernessResponderCompany] [nvarchar](250) NULL,
    [wildernessResponderImage] [nvarchar](4000) NULL,
    [wildernessResponderOnFile] [bit] NULL,
    [certNotes] [nvarchar](4000) NULL,
    [isActive] [bit] NULL,
    [certClassRegistered] [bit] NULL,
    [lifeguardInstrcutorExp] [datetime] NULL,
    [lifeguardInstrcutorCompany] [nvarchar](250) NULL,
    [lifeguardInstrcutorImage] [nvarchar](4000) NULL,
    [lifeguardInstrcutorOnFile] [bit] NULL

1 个答案:

答案 0 :(得分:5)

请注意您的所有认证如何具有相同的重复信息列:到期,公司,图像,OnFile?这是一个很大的线索,你需要进一步规范你的设计。

在一个完美的世界中(你可以进行架构更改),我将创建一个通用的学生/认证表,将这些常用元素作为列,另一个表枚举证书的外键(水安全,荒野等)和另一个将学生与这些认证联系起来的外键。类似的东西:

enter image description here