Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1008491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:46:46+00:00 2026-05-16T08:46:46+00:00

The question will best be understood with an example. I have Hospital One who

  • 0

The question will best be understood with an example.

I have Hospital One who have 3 main pharmacies called; Central Pharmacy, Ward Pharmacy, and Private Suite.

These pharmacies can be added, deleted, and extended at will. While these go on i would love to know from my code when we are talking about a Central Pharmacy or a Ward Pharmacy without hard-coding the id.

Can someone help me on how i could go about solving this problem?

I’ll present a different scenario when this is answered. Thank you everyone in advance.

Edit #1

I think there will be some kind of table design & code design pattern to enable this sort of flexibility.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:46:46+00:00Added an answer on May 16, 2026 at 8:46 am

    My initial table design would be

    CREATE TABLE Hospitals (
      HospitalID INTEGER PRIMARY KEY
      , Name VARCHAR(16)
    )
    
    CREATE TABLE PharmacyTypes (
      PharmacyTypeID INTEGER PRIMARY KEY
      , Name VARCHAR(16)
    )  
    
    CREATE TABLE Pharmacies (
      PharmacyID INTEGER PRIMARY KEY
      , HospitalID INTEGER FOREIGN KEY REFERENCES Hospitals (HospitalID)
      , PharmacyTypeID INTEGER FOREIGN KEY REFERENCES PharmacyTypes (PharmacyTypeID)
      , Name VARCHAR(16)
    )
    

    This allows for generic pharmacies to be added as well as the types you mention.

    At one point in time, one way or another you will have to hardcode either the PharmacyTypeID of Central Pharmacy (et all) or their names.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got this question from my cousin: What will be the best way to
I know this question will be closed because I studied many example of this
I am trying to understand Java's polymorphism, and I have one question about downcasting
and thanks for taking the time to read my question. We will have visitors
This question will be a little longer and I am sorry for that :)
This question will be short and sweet. I know an instruction can occur between
( Late edit: This question will hopefully be obsolete when Java 7 comes, because
I know that my question will be very similar to other ones already asked
Sorry if this question will sound too chaotic, feel free to edit it. I
I guess this question will sound familiar, but I am yet another programmer baffled

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.