I have this big database table that tracks (currently in production), a persons medical certification by: Date expires (exp), the company, if we have it on file and the location of a digital copy. We track in many (growing) categories such as CPR, CPR child, AED, Lifeguarding etc…
How do I make this easier to manage and how can I migrate existing data over? I’m coldfusion web app running SQL server 2008.
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
Notice how all of your certifications have the same repeating columns of information: Expiration, Company, Image, OnFile? That’s a big clue that you’re in need of further normalization of your design.
In a perfect world (one where you’re able to make schema changes), I’d create a generic student/certification table, with those common elements as columns, a foreign key to another table that enumerates the certificates (Water Safety, Wilderness, etc.) and another foreign key linking the students to those certifications. Something like: