Francisunoxx Francisunoxx - 4 months ago 17
MySQL Question

How handle two document type?

I'm designing my

documents
table for Document Management System. I have a many to many relationship of
users
and
documents
with a junction table of
usersdocuments
I need opinion from others because I have a two type of document which I'm gonna implement.


  • Request

  • Resolution



My plan here I'm gonna put them inside in
documents
table instead of doing two table. I need determine which document type does the user is using? What kind of data type I'm gonna use to implement this?

SC

Answer

What kind of data type I'm gonna use to implement this? To avoid confusion using BIT.

Yes you can use BIT as the datatype for that column like

IsRequest BIT(1)

Since there is only two types Request and Resolution you can figure it out by saying

select * from documents
where IsRequest = 'true'; // want to fetch only Request type
Comments