Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to normalize it

Author  Topic 

Abid

110 Posts

Posted - 2013-04-20 : 11:19:31
Hi. I have some 15 attributes which i need to put in single table, but if i do this so redundency, and partial and transitive dependencies are rising. The situation is as under:

PatientInfo
PatientID, Name, FatherName, Age, Sex, Address, ContactID

UserInfo
UserID, Name, DutyShift, Cadre, Status, Login Time, Entries

How do i normalize it? What i need is to simply save the record, that which user, in which shift, how many patients he dealt, on daily date? Please guide me.

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-04-20 : 12:51:23
quote:
Originally posted by Abid

Hi. I have some 15 attributes which i need to put in single table, but if i do this so redundency, and partial and transitive dependencies are rising. The situation is as under:

PatientInfo
PatientID, Name, FatherName, Age, Sex, Address, ContactID

UserInfo
UserID, Name, DutyShift, Cadre, Status, Login Time, Entries

How do i normalize it? What i need is to simply save the record, that which user, in which shift, how many patients he dealt, on daily date? Please guide me.

If your requirement indeed is that you need to put all of it into a SINGLE table, I don't know of a way to normalize it. When you normalize, you necessarily end up with more than one table.

That said, I think what you need to do is to have a series of tables:
1. Patients - pretty much like what you have.
2. Users - I assume this is employees at the facility.
3. Shifts - This would indicate when a shift starts, when it ends etc.
4. UserShifts - This would relate Users who are working a given shift
5. UserPatients - This would have an entry each time a user deals with a patient.

I want to make the disclaimer that I don't know anything about your business requirements, so this is just an educated guess.
Go to Top of Page

Abid

110 Posts

Posted - 2013-04-20 : 22:00:26
Ok. Lets say if i don't use single table and use the same 2 tables as i have, so what will be your opinion then?

Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-04-21 : 07:34:29
If you can use only two tables, what you have there is pretty much what you need. Each time a user completes a duty shift, you would enter one row with his/her name, how many patients he cared for, and any other information required. etc. That would of course mean that you would be repeating the information such as Cadre, Status etc. in every row.

Is there any reason you cannot add normalized tables? The cost of adding a new table is so little (some metadata) and the benefits in terms of storage, ease of querying, maintenance etc can be significant.
Go to Top of Page
   

- Advertisement -