Myaccount
Myaccount

Reputation: 79

Yes/No attributes in logical database design

I have an assignment where I have to design a logical model using SQL developer.

I am converting a conceptual model to a logical model. And I Have a relation NURSE that has "nurse_id" and "certification". The certification attribute has yes/no values.

My question is: Should I move the yes/no attribute to a new relation? or is it okay to keep it in the same NURSE relation. What is the best practise.

and is the suitable data type for that attribute (CHAR)?

Thank you,

Upvotes: 0

Views: 2363

Answers (2)

gagarwa
gagarwa

Reputation: 1492

Because the certification only has yes/no values, I would recommend keeping them in the same table as a one to one mapping. If one nurse could get several certifications, then another table would be useful as a many to one or one to many mapping.

As for the data type, CHAR is fine. If you want to save space you can also use BOOLEAN, then parse this as yes/no in the application.

Upvotes: 0

zedfoxus
zedfoxus

Reputation: 37069

Keep it in the NURSE relation as it would be easy to query how many nurses have certification and how many don't, and which nurses have certification.

You can use either CHAR(1) and type in Y or N. You can use a BIT datatype if database supports it. You can use a Boolean if database supports it. Since all major databases will have a CHAR(1), I'd just keep it CHAR(1)

Upvotes: 1

Related Questions