Question

Database Design

Asked by: czechmate1976

Can someone try to help draw an Entity Relationship diagram for a database... I neglected that part of my study and feel hopeless.. Any help will be much appreciated.. The file attached states some criteria for the db..

  • DST.doc
    • 51 KB

    Database requirements

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-01-11 at 10:58:38ID24042536
Topics

Design & Methodology

,

Microsoft Visio

Participating Experts
6
Points
500
Comments
39

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. HELP PLZ with an entity relationship diagram
    Hi there, im new to the concept databases and currently i am at the stage of learning about Entity relationship diagrams. Im working through an excercise given in a text book which ive included below........ As well as selling jewellery, John's jewels of Hatton Garden unde...
  2. Entity Relationship Diagram
    I really need some advice on how to go about tackling an entity relationship diagram. I have to design one based on a bookshop and have to show the cardinality and optionality of each relationship which I identify. I understand what this means and have looked over some exampl...
  3. Entity Relationship Diagram for Mysql tables
    How can I make Entity relationship diagram for my Mysql tables. Is there any tools for that?
  4. Entity relationship diagram
    Consider whether you would use the entity relationship diagram (ERD) to diagram the database design, or have you found them to be outdated and a waste of time?
  5. Free Software(Downlodable) for drawing Use Cases,Cl…
    Hi, I'm looking for free downloadable software to draw Use Cases,Classdiagram and Entity Relationship diagram. Some free softwares force you to draw in a certain ways. I'm looking to draw in pure object oriented way. Please recommend if there is any software in the Internet.

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: emoreauPosted on 2009-01-12 at 08:00:06ID: 23354316

that's homework!

 

by: LSMConsultingPosted on 2009-01-12 at 08:12:59ID: 23354452

We can help you understand what an entity diagram is, but we won't do it for you. First you'd need to decide what major data "entities" you have ... for example, you'd likely need to store information about Patients, Clinics, Doctors, etc etc ... those would be "entities", and each would likely require a table. You'd also need to determine the "properties" of those entities (eg, the Name of the clinic, Location etc etc) and decide which of those might be best represented by related tables, or by directly storing this info in the main tables ... from there you simply keep working the data, refining it until you have the basic data entities, properties, etc in some sort of logical format. From there, you'd then sketch your ER diagram.

 

by: czechmate1976Posted on 2009-01-12 at 08:24:54ID: 23354585

That is right that is a homework.. but if I upload the ER I attempted to draw, could someone to tell me if I am on the right track, please...  I don't want anyone to do my homework, just need some ideas to compare with mine. Thanks a lot

 

by: LSMConsultingPosted on 2009-01-12 at 08:47:21ID: 23354832


How is a Vaccine related to an Appointment?

How is a Vacinne related to Staff?

How is an Invoice related to a Vacinne?

Can a patient have more than one Vacinne on a single Appointment?

Would an Invoice ever have more than one item?

 

by: czechmate1976Posted on 2009-01-12 at 08:53:27ID: 23354880

Vaccine to appointment... I need to record what vaccines are administered at an appointment (yes, a patient can receive more than one vaccing per appointment)
Vaccine to staff .. staff that administer a vaccine also need to be recorded in the db
Invoice to vaccine .. Invoice records all vaccine adminestered per appointment (thus invoice can record more than one vaccine..

Thank you for your help.. much appreciated.. as I said, really need to know if I am going in the right direction and if it makes sense.

 

by: ramromPosted on 2009-01-12 at 09:07:04ID: 23355039

Good start.

I wrote this while LSMConsulting was writing his. So there is some overlap.

I assume each arrow represents a 1-many relationship with the many at the arrowhead.

I am not an expert at the formalism of ER diagrams so this is my opinion: I recommend putting the 1 side of the arrow next to the id that relates to the other table. For example the left side of the arrow from patients to appointments should start at patient_id. Especially in the case of the vaccines-clinic connection.

Check for missing FKs.

To check the correctness of the direction of an arrow - translate to a sentence e.g. one patient has zero-or-more appointments. Some of the arrows point the wrong way. At least one arrow should not be there. Some of the relationships are 1-1 rather than 1-many.

Did you design the tables? If so consider that staff and patients have a lot in common. What does that suggest?

 

by: LSMConsultingPosted on 2009-01-12 at 09:08:18ID: 23355049

These are questions that YOU need to answer ... I'm not concerned with them, but merely posted them to perhaps encourage you to examine why you're tracking these as you are.

<yes, a patient can receive more than one vaccing per appointment>

How would you record this?

More ???:

How are StaffId and ApptID related to Vaccines?

Can a Patient have more than one Appointment, at more than one Clinic?

Can a Patient make a partial payment?

These are things which you need to think about before you can really build your ER diagram. At this stage, you've got a fairly decent grasp of what's going on, but you need to rethink some of your relationships.


 

by: czechmate1976Posted on 2009-01-12 at 09:37:43ID: 23355399

Thank guys for the tips, will have a look at the arrows and relations...  Now that I am trying to populate the tables, just to see the connections and how the tables link.. it looks like I have no data to put in the  vaccine table in the fields staff id, and appointment id.. but I do need to record who administered the vaccine and which vaccines were administered at each appointment.  Should I create some entity in between vaccine table and the appoinment table and that entity would also then be connected to the invoice ... it's all so confusing.. Thanks for your help

 

by: ramromPosted on 2009-01-12 at 09:45:26ID: 23355477

I'm curious - I'd think the course-instructor-textbook-whatever would provide you with the tools and methods for solving this problem. What is missing that it is so confusing?

The more effort we EEs put into this problem the more it looks like we are becoming the course-instructor-textbook-whatever. That is not our role - to make up for school deficiencies. Or else you have not utilized the resources available or don't have the time for that.

Which is the case?

 

by: czechmate1976Posted on 2009-01-12 at 09:52:02ID: 23355529

You are probably absolutely right .. and I am not going to make excuses but one, it is quite tough to try to work full-time and study full-time, so I did neglect this subject. Nevertheless, I am working on it quite hard now to catch up and got some good ideas here now as well. I sincerely apologize for wasting your time and do realize that this is not the purpose of EE. Being honest, i looked for a bit of a shortcut. But back to books and drawings now. Thanks again and sorry.

 

by: czechmate1976Posted on 2009-01-12 at 09:53:06ID: 23355534

absolutely right - not probably (I don't make sense here now at all)

 

by: scottPosted on 2009-01-12 at 09:57:02ID: 23355566

One additional thought that could help provide a sanity check after you create the database -- Visio can "reverse engineer" a database, i.e., you can create a database model diagram from an existing database. I'm not suggesting it will be a perfect diagram but it would give you something to compare with the diagram you created from scratch.

You didn't mention which version of Visio you're using. The instructions below apply to Visio 2007 -- if you're using an earlier version the name and location of the template might be different but the reverse engineering wizard is still there.

In Visio 2007:

  • select File/New  
  • select the Software and Database folder  
  • select the Database Model Diagram  
  • after the new document opens, select Database/Reverse Engineer... and step through the wizard  

Scott



 

by: KdoPosted on 2009-01-12 at 10:11:55ID: 23355693

Hi czechmate,

That looks like a pretty good start, :), but check the relationship portion of the diagram.  The one-directional arrow indicates that a table has a dependency on a data item in a different table.  The arrows in your diagram don't seem to represent what I would expect.  Directly or indirectly, the tblappointments table is dependent on data in every other table.  I would expect that that would be the characteristic of tthe tblinvoices table as you can't really have an invoice without a clinic, patient, appointment, and perhaps staff.


Good Luck,
Kent

 

by: czechmate1976Posted on 2009-01-12 at 10:59:29ID: 23356115

Thanks Kdo, that really makes sense now that I am reading it.. will try it out if it gives the required results.

 

by: czechmate1976Posted on 2009-01-12 at 11:16:42ID: 23356270

Does this make sense... I tried to place the invoice in the centre..and play around with the other associations a bit

 

by: KdoPosted on 2009-01-12 at 11:24:14ID: 23356351

Based on the table structures, it does.

But it seems to me that the general relationship between the appointments and invoices tables is backwards.  If I were responsible for the design, the arrow between the tables would be reversed and the invocies table would have a field to indicate that it is tied to an appointment.


Kent

 

by: czechmate1976Posted on 2009-01-12 at 11:38:21ID: 23356477

It does make better sense.. I was thinking about it too but sometimes you need to hear it from someone else to belivieve your judgement is right. Thanks for the input.. the diagram really starts to make much better sense now!

 

by: psasikPosted on 2009-01-15 at 08:22:26ID: 23384905

czech,

That's looking good. i think that if you want an A+, you could add a table called Position or StaffType or some such where the staff table would foreign key into it (instead of having a tblStaff.Position column). That would allow you add additional staff types without much tweaking.

Gender is another possibility... That's right. i've worked on a number of US-based clinical applications and have seen as many as seven gender types!

 

by: LSMConsultingPosted on 2009-01-15 at 08:42:08ID: 23385152

My only quibble would be the relationship between Invoice and Clinic ... you're already representing this through the Appointment, thus I see no reason to store ClinicID in tblInvoice, and it's seem to me that a Clinic is more closely related to an Appointment than it is an Invoice. IOW, you can always "get to" the ClinicID through the Appointment (to which the Invoice is correctly related), thus there's no need to store ClinicID in tblInvoice.

 

by: czechmate1976Posted on 2009-01-15 at 09:10:20ID: 23385460

Thanks guys for more tips, guess I will have to do more re-thinking once I win my fight against a nasty flu bug (which has also been the reason for not being online for the past 3 days) ...  Thanks guys a lot

 

by: czechmate1976Posted on 2009-01-16 at 02:27:59ID: 23391618

Regarding the latest post of LSMConsulting... I understand what you mean by that but wouldnt the same principle apply to the relation tblinvoice and tblpatients, as there, too, it can be accessed through the table appointments, no?

 

by: LSMConsultingPosted on 2009-01-16 at 04:42:08ID: 23392224

My point is there doesn't seem to be any reason to relate both an Invoice and an Appointment to a Clinic. Choose one but not both. Further, there doesn't seem to be any reason to relate a VaccineSet to a Clinic ... to me, a VaccineSet would be part of an Appointment or Invoice, assuming that a VaccineSet is a group of Vaccines that is administered to a Patient.

Which brings up the VaccineSet table. Is this a many-to-many Join, where you'd store multiple Vaccines given to a specific Patient (i.e. during an Appointment)? If so, the you're not storing that correctly ... IF this is the case, then you'd store (a) tblVaccines.VaccineID and (b) tblINvoices.InvoiceID in your tblVaccineSets. In this particular instance, tblVaccines would be a "lookup" table to tblVaccineSets. Also, you would NOT store tblClinic.ClinicID ... a VaccineSet has nothing to do with a Clinic (from a data standpoint, at least) but would instead be more closely associated to an Invoice or Appointment (IMO, that is).

Note these are simply my views ... there are many different ways to store data, but IMO you've got a few little issues with this. Overall, however, a very good start and a good learning experience for you!

 

by: czechmate1976Posted on 2009-01-16 at 05:21:34ID: 23392470

OK, I have been playing with it a bit more and have come to this, I am sure there is a bummer in it somewhere again but now I am not sure of anything anymore :-) . Please could you once more have a look at the diagram and tell me what you think

 

by: KdoPosted on 2009-01-16 at 07:30:28ID: 23393826

Hi czechmate,

I'm still not comfortable with the structure around the invoices table.  It would seem to me that an invoice can be generated by an appointment or the administration (delivery) of a vaccine.  Depending on the business rules, an invoice could be the result of multiple appointments, vaccines, and/or vaccine sets.

If a patient is prescribed a vaccine set, it may be that the vaccinations occur over an extended period of time.  If so, it's appropriate to bill as each vaccine is administered.  Or is the vaccine_set simply the link item between the other tables with a vaccine set referencing a single vaccine?

Still, it seems that the invoices table should be a parent/child with the appointments table.  An appointment generates a bill.  You can see the doctor without getting a vaccine.  But you cannot get a vaccine without being in the doctor's office.


Kent

 

by: czechmate1976Posted on 2009-01-16 at 07:42:57ID: 23393994

The vaccines are supposed to be invoiced per appointment according to the task list.. The vaccine set table should be a link in a many-to-many relationship between the tblvaccine and tblappointments as a vaccine can be administered at many appointments and one appointment can serve to administer many vaccines --- not sure if I am totally right.

Anyway, I dont know any more where to put the invoice and how to relate it to what.. I though it should be coming off the appointment but then the vaccines need to be related to it as well... LOST LOST LOST

 

by: KdoPosted on 2009-01-16 at 08:04:02ID: 23394232

I don't think that you're lost at all.  In fact, you seem to have a pretty good handle on what you need.  :)

Let's go back to the invoice relationship.  Nothing happens between the doctor and patient without an appointment.  Even walk-in care can be logged with the appointment structure.  So let's tie the invoice to the appointment.  (When you go to the doctor, you have to pay.)

Additional charges may be incurred due to the delivery of medication -- the vaccine_set table.  And because it's possible to receive more than 1 dose per appointment (either multiple doses of the same vaccine or multiple vaccines) the relationship between the appointment and vaccine_set tables must be reversed.  The vaccine_set will identify the appointment during which the dosage was administered.

Now the only big decision would seem to be if a single invoice will cover multiple appointments, multiple invoices can be produced from a single appointment, or if the relationship is 1-to-1.  I would expect 1-to1 or 1 invoice to multiple appointments (e.g. monthly billing).


Kent

 

by: czechmate1976Posted on 2009-01-16 at 09:00:09ID: 23394879

This made it a bit clearer. Thanks for that. The invoice - appointment should be a 1-to-1 relationship.. but at single appointments more than one vaccine can be administered.

Should the invoice come off the appointment then or  the vaccine set like this

 

by: KdoPosted on 2009-01-16 at 09:57:07ID: 23395420

I'd still change this so that the link between the invoices and appointments tables was direct and that access to the invoice table from any other table was via the appointment table.

The appointments table controls/records events.  Who was scheduled with an appointment, which clinic, what date/time, what services were rendered, etc.  The invoice is just a summary of the price of the events that transpired due to an appointment.


Kent

 

by: czechmate1976Posted on 2009-01-16 at 10:16:23ID: 23395660

So it should look like something like this

 

by: KdoPosted on 2009-01-16 at 10:31:16ID: 23395830


I like it.  :)

 

by: ramromPosted on 2009-01-16 at 10:42:59ID: 23395981

Did I mention that staff and patients are subsets of persons? Since there are so many common fields I'd make a person table to hold the common stuff; this would then relate to patient and staff tables which hold the unique data. This also allows a staff member to be a patient without duplication of data which is a no-no.

I enjoy this discussion as it shows that there can be different ways to model an application.

This is the first time I have heard of "task list". What is that / where did it come from? Could we see it?

I distinguish between appointment and visit. Appointments schedule visits. They are a "plan". The actual visit is a different thing.

Looking down the road I see that during a visit a patient receives services (as we know from the inevitable form clinics use to report what was done for the patient). Vaccination is one of many services.

Now as I look at patient, staff and clinic I see a new common entity "address". Should this be a separate table?

And don't many of us have more than one phone number?

And on and on ...

 

by: KdoPosted on 2009-01-16 at 11:01:30ID: 23396178


Hi ramrom,

I don't see enough difference between an appointment and visit to separate them.  At least not for an exercise.  (In the real world, I'm one of the "great normalizers" and probably would separate them.)  An appointment is simply the scheduling of a visit.  By using NULL for the appointment time/date the same structure can differentiate and manage scheduled appointments/vists and walkins.  If the number of no-shows is relatively small, the waste generated by the unused fields in the appointment record is more than offset by the simpler design.

And I agree about normalizing the people tables.  In the "real world" I would definitely normalize the people demographics so that there would be staff, patient, and demographics tables.


Kent

 

by: czechmate1976Posted on 2009-01-16 at 11:11:00ID: 23396284

Thanks Ramrom for your input, I was also looking for similarities between the staff table and patients table.. and I am sure someone like you knows the correct way to apply it but I am a student and I am sure that it would kind of confuse my tutors... who I believe dont know as much as you guys.. As to the task list - that is the DST.doc I have uploaded at the beginning that contains the requirements of the database.. I have been killing myself with for days.

Anyway, I have added a tblvaccine_stock between tblvaccines and tblclinics as is seems to me a many-to-many relationship (Some of you didn't like to connection there at all but I somehow think how otherwise to control the stock - stop me if I talk crap please - or if I am browsing into even more complicated design)

 

by: ramromPosted on 2009-01-16 at 16:00:30ID: 23398694

Thanks for the pointer to DST.doc. I seem to overlook attachments in questions!

 

by: LSMConsultingPosted on 2009-01-16 at 16:19:27ID: 23398795

I like that ER diagram a lot better ... good luck, I think you're on the right path.

 

by: KdoPosted on 2009-01-16 at 16:24:04ID: 23398815


Yep.  It's lookin' good.  :)

 

by: czechmate1976Posted on 2009-01-21 at 01:49:00ID: 31533344

Thanks guys for your guidance. I actually start to enjoy it now :-)

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...