Thread: i have some question regarding to blood bank management system database

  1. #16
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by tryharder1 View Post
    The way to do so is as shown below, right?
    Why have you just now created a BloodBags table? You already have blood bags in the inventory table. One blood bag per record in the inventory table.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #17
    Registered User
    Join Date
    Dec 2016
    Posts
    16
    Sorry, it was my mistake. After i edited the post once yesterday and i unable to edit it for the second times.
    Thanks for your guidance and time.

  3. #18
    Registered User
    Join Date
    Dec 2016
    Posts
    16
    Can i know whether there is better way to do this or usually combine blood group and blood type together by creating a new table?

    Code:
    Donors : donorID, bloodGroupID, bloodTypeID, ..etc
    BloodGroups : bloodGroupID, remarks..etc
    BloodTypes : bloodTypeID, remarks..etc
    or

    Code:
    Donors : donorID, bloodID, ..etc
    Bloods : bloodID, bloodGorup, bloodTypeID, remarks..etc
    BloodTypes : bloodTypeID, remarks..etc
    Last edited by tryharder1; 12-08-2016 at 08:56 AM.

  4. #19
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    What is a blood type and how is it different from a blood group?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #20
    Registered User
    Join Date
    Dec 2016
    Posts
    16
    Oh ya, sorry forgot to mention it.
    Bloodgroup is A,B,AB,O...
    Bloodtype is positive, negative..
    This is because I need to keep track of the blood details like O+ in my blood inventory.
    So that i can't put bloodgroup attribute and bloodtype attribute in my donors table right?

  6. #21
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Depending on your needs you may not need that level of granularity on your data. A BloodGroup table could have the following simple structure:

    Code:
    BloodGroupID, varchar(3), primary key
    And the data for this table could be:

    Code:
    A+
    A-
    B+
    B-
    AB+
    AB-
    O+
    O-
    This would cover all blood groups.
    You could then put a BloodGroupID field on the Donors table alone. Because the BloodInventory table will point indirectly to the Donors table through the Appointments table, you can always establish a JOIN to get to the blood group.

    Code:
    BloodGroups : BloodGroupID
    Donors : DonorsID, BloodGroupID
    Appointments : AppointmentID, DonorID, Date, Time
    BloodInventory : BloodInventoryID, AppointmentID
    With those fields alone, you have all your basic structure set and ready to take the foreign keys to establish the relationship between the table.
    You just need 3:

    Code:
    ALTER TABLE Donors
        ADD CONSTRAINT Donors_fk_BloodGroupID  FOREIGN KEY (BloodGroupID) REFERENCES BloodGroups(BloodGroupID)
        ON UPDATE CASCADE ON  DELETE RESTRICT;
    ALTER TABLE Appointments
        ADD CONSTRAINT Appointments_fk_DonorID FOREIGN KEY (DonorID) REFERENCES Donors(DonorID)
        ON UPDATE CASCADE ON DELETE RESTRICT;
    ALTER TABLE ONLY BloodInventory
        ADD CONSTRAINT BloodInventory_fk_AppointmentID FOREIGN KEY (AppointmentID) REFERENCES Appointments(AppointmentID)
        ON UPDATE CASCADE ON DELETE RESTRICT;
    This way:

    Code:
    BloodGroups 1:N Donors
    Donors 1:N Appointments
    Appointments 1:1 BloodInventory
    To make sure that the last relationship is a 1:1 and not a 1:N (meaning that of course 1 appointment can only generate one blood entry in the inventory), when you are creating the BloodInventory table, the AppointmentID field must have a UNIQUE constraint. Alternatively, you don't need the BloodInventoryID field and you can just make AppointmentID the primary key of the BloodInventory table.

    EDIT: pardon, the relationship between Appointments and BloodInventory is actually "1:0 or 1", not "1:1". An appointment may be cancelled and not generate an entry in the inventory. The above establishes exactly that possibility.
    Last edited by Mario F.; 12-08-2016 at 01:33 PM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #22
    Registered User
    Join Date
    Dec 2016
    Posts
    16
    Okay.

    Code:
    Donors : donorID, bloodGroupID ...etc
    BloodGroups : bloodGroupID, quantity ..etc
    BloodBanks: bloodBankID,..etc
    Appointments : appointmentID, bloodBankID, donorID..etc
    BloodInventory : bloodInventoryID, bloodBankID, appointmentID,..etc
    And if i have a seeker it will link to the BloodGroups table? E.g

    Code:
    Seeker : seekerID,..
    BloodRequests : seekerID, bloodGroupID, qty...
    BloodGroups : bloodGroupID...

  8. #23
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I don't know what a seeker is and I don't care. I think between these two pages or replies and your own study of database design, you can finish whatever you are doing.
    Enough.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #24
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    My guess is a seeker is a person in the queue waiting for blood.

    Also, OP's user name is ironic.

  10. #25
    Registered User
    Join Date
    Dec 2016
    Posts
    16
    Sorry, i just want to ensure everything go in right way since no one there to tell me.
    If my question bothered you guys then i apologize for it and thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help Regarding Bank System Project!
    By saddists in forum C Programming
    Replies: 2
    Last Post: 12-27-2011, 06:36 AM
  2. A database sort of management system
    By relyt_123 in forum C++ Programming
    Replies: 5
    Last Post: 07-01-2008, 03:11 AM
  3. Bank like system
    By Signpost in forum C Programming
    Replies: 20
    Last Post: 03-30-2008, 12:52 PM
  4. Database Management Programming.
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 01-17-2006, 05:03 PM
  5. Database management
    By waterst in forum C Programming
    Replies: 0
    Last Post: 11-04-2002, 10:00 AM

Tags for this Thread