Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Database design and Development

813 views

Published on

Database design and Development course work under NCC Education in December 2010

Published in: Software
  • Be the first to comment

Database design and Development

  1. 1. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development
  2. 2. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Statement and Confirmation of Own Work Programme/Qualification name: Each NCC Education assessed assignment submitted by you must have this statement attached to the assignment as the cover page or it will not be accepted for marking. Please ensure that this statement is either firmly attached to the cover of the assignment or electronically inserted into the front of the assignment. Student declaration I have read and understood NCC Education’s Policy on Academic Dishonesty and Plagiarism. I can confirm the following details: Student ID/Registration number: Name: Centre Name: Module Name: Module Leader: Number of words: I confirm that this is my own work and that I have not plagiarized any part of it. I have also noted the assessment criteria and pass mark for assignments. Due Date: Student Signature: Submitted Date:
  3. 3. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Acknowledgment I am Md. Mahbub Alam is grateful to Daffodil Institute of IT (DIIT) for giving the chance to do the assignment in the field of Database design and Development. I am also grateful & like to thank Md. Ashik Mahmud Lecturer of Database Design & Development of DIIT. His continues support, interest & encouragement help me to complete this assignment. Huge unknown things are now know to me by doing this assignment. In class room we collect knowledge about database but practically I collect knowledge by doing this assignment. It was a glorious memory by doing this assignment in my Life.
  4. 4. Task - 1 Entity Relationship Diagram (ERD): Doctor DoctorID DoctorName DoctorAddress DoctorTelephone DoctorMobile BranchID AnimalType AnimalTypeId AnimalTypeName Branch BranchID BranchName BranchAddress BranchTelephone OpeningHour EmergencyTelephone Specialization AnimalTypeId DoctorID Specialization1 Specialization2 Specialization3 Breed BreedID AnimalTypeId BreedName Need for Need Given by Gives Need For Work in a Have For Need Need Need Need For Owner OwnerID OwnerName OwnerAddress OwnerTelephone OwnerMobile Animal AnimalID OwnerID BreedID Age Sex AnimalName Appointment AppointmentID AnimalID DoctorID AppointmentDate AppointmentTime Charge AppointmenntTime Need Has a Have a Need R1 R2 Made by Make Made By Makes For Record of R3 R4 R5 R6 R7 R8 R9 R11 R12 R10 Prescription PrescriptionID AppointmentID Period(Day) Pre-Drug PrescriptionID DrugID Drug DrugID DrugName Cost DrugTypeID DrugType DrugtypeID DrugType
  5. 5. Representing Entities:  Owner Entity defined as below: Entity : Owner Description : Authoritarian of pets. Identifying Attribute : OwnerID Other Attribute : OwnerName, OwnerAddress, OwnerTelephone, OwnerMobile.  Animal Entity defined as below:  Animal Type Entity defined as below:  Doctor Entity defined as below:  Branch Entity defined as below: Entity : Animal Description : Pet of owner. Identifying Attribute : Animal ID Other Attribute : OwnerID, BreedID, Age, Sex, animalName Entity : AnimalType Description : Kinds of Animal. Identifying Attribute : AnimalTypeID Other Attribute : AnimalTypeName. Entity : Doctor Description : Consultant of animals. Identifying Attribute : DoctorID Other Attribute : DoctorName, DoctorAddress, DoctorTelephone, DoctorMobile, BranchID,
  6. 6. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Entity : Branch Description : Local office of the Headquarter. Identifying Attribute : BranchID Other Attribute : BranchName, BranchAddress, BranchTelephone, OpeningHour, EmergencyTelephone .
  7. 7. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development  Drug Entity defined as below:  Pre- Drug Entity defined as below:  Appointment Entity defined as below:  Prescription Entity defined as below:  Drug Type defined as below:  Breed Entity defined as below: Entity : Drug Description : Medicine of pets. Identifying Attribute : DrugID Other Attribute : DrugName, Cost, DrugType. Entity : Pre- Drug Description : Medicine of pets. Identifying Attribute : DrugID Other Attribute : PrescriptionID Entity : Appointment Description : Proposal for the meeting time. Identifying Attribute : Appointmen ID Other Attribute : AnimalID, DoctorID, AppointmentDate, AppointmentTime, Charge, appointmentTime Entity : Prescription Description : Doctor Instruction about Medicine. Identifying Attribute : PrescriptionID Other Attribute : AppointmentID, Period(Day Entity : DrugType Description : Detail about Drug. Identifying Attribute : DrugTypeID Other Attribute : Drugtype, Medication, Antibiotic
  8. 8. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development  Specialization Entity defined as below: Entity : Breed Description : Variety of animal. Identifying Attribute : BreedID Other Attribute : AnimalTypeID, BreedName Entity : Prescription Description : Doctor Instruction about Medicine. Identifying Attribute : AnimalTypeID Other Attribute : DoctorID, Specializaion1, Specializaion2, Specializaion3
  9. 9. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Representing Relationship: Relationship ID : R1 Relationship Name : Made by, Make Description : Drug type made by drug. Participating Entity : DrugType Cardinality : One Optionality : None Participating entity : Drug Cardinality : Many Optionality : None Relationship ID : R2 Relationship Name : Made by, Make Description : Prescriptions contain drug information. Participating Entity : Drug Cardinality : One Optionality : None Participating entity : Pre-Drug Cardinality : Many Optionality : None Relationship ID : R3 Relationship Name : For, Record of Description : Animal need a prescription to record drugs data. Participating Entity : Pre-Drug Cardinality : Many Optionality : None Participating entity : Prescription Cardinality : One Optionality : None Relationship ID : R4 Relationship Name : Need for, Need Description : For prescription first have to be make a appointment. Participating Entity : Prescription Cardinality : Many Optionality : None Participating entity : Appointment Cardinality : One Optionality : None Relationship ID : R5 Relationship Name : Given by, Gives Description : To make a meeting with doctor, Animal has to be appointment first. Participating Entity : Appointment Cardinality : One Optionality : None
  10. 10. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Participating entity : Doctor Cardinality : One Optionality : None Relationship ID : R6 Relationship Name : For, Need Description : Doctor may specialize in the treatment. Participating Entity : Doctor Cardinality : One Optionality : None Participating entity : Specialization Cardinality : Many Optionality : None Relationship ID : R7 Relationship Name : Work in, Have Description : Doctors are work in a branch. Participating Entity : Doctor Cardinality : Many Optionality : None Participating entity : Branch Cardinality : One Optionality : None Relationship ID : R8 Relationship Name : Need, For Description : Specialization needs animalType. Participating Entity : Specialization Cardinality : Many Optionality : None Participating entity : AnimalType Cardinality : One Optionality : None Relationship ID : R9 Relationship Name : Need, need Description : Breed needs AnimalType. Participating Entity : Breed Cardinality : Many Optionality : None Participating entity : AnimalType Cardinality : One Optionality : None
  11. 11. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Relationship ID : R10 Relationship Name : Need, For Description : Animal have to make a appointment Participating Entity : Animal Cardinality : One Optionality : None Participating entity : Appointment Cardinality : One Optionality : None Relationship ID : R11 Relationship Name : Need, Need Description : Animal need breed. Participating Entity : Animal Cardinality : Many Optionality : None Participating entity : Breed Cardinality : One Optionality : None Relationship ID : R12 Relationship Name : Have a, Has a Description : Owner has an animal. Participating Entity : Owner Cardinality : One Optionality : None Participating entity : Animal Cardinality : Many Optionality : None
  12. 12. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Task – 2 Normalized Entity Tables: Table Name: Owner Field Name Data Type Length Null? Primary Key Foreign Key Ref Table On Delete On Update Check OwnerID INTEGER 4 Not null Yes No - - - - OwnerName VARCHAR 30 Not null No No - - - - OwnerAddress VARCHAR 50 Not null No No - - - - OwnerTelephone INTEGER 20 Not null No No - - - - Owner Mobile INTEGER 20 Not null No No - - - - Table Name: Animal Field Name Data Type Length Null? Primary Key Foreign Key Ref Table On Delete On Update Check AnimalID INTEGER 4 Not null Yes No - - - - OwnerID INTEGER 4 Not null No Yes Owner CASCADE CASCADE - BreedID INTEGER 15 Not null No No Breed CASCADE CASCADE - Age INTEGER 4 Not null No No - - - - Sex VARCHAR 10 Not null No No - - - - Table Name: Doctor Field Name Data Type Lengt h Null? Primary Key Foreign Key Ref Table On Delete On Update Check DoctorID INTEGER 4 Not null Yes No - - - - DoctorName VARCHAR 30 Not null No No - - - - DoctorAddress VARCHAR 50 Not null No No - - - - DoctorTelephone INTEGER 20 Not null No No - - - - DoctorMobile INTEGER 20 Not null No No - - - - BranchId INTEGER 4 Not null No Yes Branch CASCADE CASCADE - Table Name: Branch Field Name Data Type Length Null Primary Foreign Ref On On Check
  13. 13. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development ? Key Key Table Delete Update BranchID INTEGER 4 Not null Yes No - - - - BranchName VARCHAR 15 Not null No No - - - - BranchAddress VARCHAR 50 Not null No No - - - - BranchTelephone INTEGER 17 Not null No No - - - - OpeningHour INTEGER 5 Not null No No - - - - EmergencyTelephone INTEGER 17 Not null No No - - - - Table Name: Drug Field Name Data Type Length Null ? Primary Key Foreign Key Ref Table On Delete On Update Check DrugID INTEGER 4 Not null Yes No - - - - DrugName VARCHAR 15 Not null No No - - - - Cost INTEGER 4 Not null No No - - - - DrugTypeID INTEGER 15 Not null No Yes DrugType CASCADE CASCADE - Table Name: Pre-Drug Field Name Data Type Length Null ? Primary Key Foreign Key Ref Table On Delete On Update Check Prescriptio nID INTEGER 4 Not null No Yes Prescription CADCADE CADCADE - DrugID INTEGER 4 Not null No Yes Drug CADCADE CADCADE - Table Name: AnimalType Field Name Data Type Length Null? Primary Key Foreign Key Ref Table On Delete On Update Check AnimalTypeID INTEGER 4 Not null Yes No - - - - AnimalTypeName VARCHAR 30 Not null No No - - - -
  14. 14. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Table Name: Appointment Field Name Data Type Length Null? Primary Key Foreign Key Ref Table On Delete On Update Check AppointmentID INTEGER 4 Not null Yes No - - - - AnimalID INTEGER 4 Not null No Yes Animal CASCADE CASCADE - DoctorID INTEGER 4 Not null No Yes Doctor CASCADE CASCADE - AppointmentDate VARCHAR 20 Not null No No - - - - AppointmentTime VARCHAR 10 Not null No No - - - - Charge INTEGER 4 Not null No No - - - - Table Name: Prescription Field Name Data Type Length Null ? Primary Key Foreign Key Ref Table On Delete On Update Check AppointmentID 4 Not null No No - - - - AnimalID INTEGER 4 Not null No Yes Animal CASCADE CASCADE - Period (Day) INTEGER 4 Not null No No - - - - Table Name: DrugType Field Name Data Type Length Null? Primary Key Foreign Key Ref Table On Delete On Update Check DrugTypeID INTEGER 5 Not null Yes No - - - - DrugType VARCHAR 4 Not null No No - - - - Table Name: Breed Field Name Data Type Length Null ? Primary Key Foreign Key Ref Table On Delete On Update Check BreedID INTEGER 5 Not null Yes No - - - - AnimalTypeID INTEGER 4 Not null No Yes AnimalType CASCADE CASCADE - BreedName VARCHAR 3 Not null No No - - - -
  15. 15. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Table Name: Specialization Field Name Data Type Length Null? Primary Key Foreign Key Ref Table On Delete On Update Check AnimalT ypeID INTEGER 4 Not null No No AnimalType CASCADE CASCADE - DoctorID INTEGER 4 Not null No Yes Doctor CASCADE CASCADE - Specializ ation1 VARCHAR 20 Not null No Yes - - - - Specializ ation2 VARCHAR 20 Not null No No - - - - Specializ ation3 VARCHAR 20 Not null No No - - - -
  16. 16. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Task – 3 Printouts of all tables using Database Management System (DBMS): Fig: Creating a database of petcare
  17. 17. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: Creating a table of animal
  18. 18. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: Animal table
  19. 19. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: animalType table
  20. 20. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: appointment table
  21. 21. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: branch table
  22. 22. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: breed table
  23. 23. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: doctor table
  24. 24. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: drug table
  25. 25. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: drugType table
  26. 26. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: owner table
  27. 27. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: prescription table
  28. 28. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: prescriptionDrug table
  29. 29. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: specialization table
  30. 30. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Fig: Table relations are showing here
  31. 31. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Task – 4 Printouts of SQL code: Fig: SQL code of quary1
  32. 32. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Output of the Quary1: Fig: SQL codes output of quary1
  33. 33. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Printouts of SQL code: Fig: SQL code of Quary2
  34. 34. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development Output of the Quary2: Fig: SQL codes output of quary2
  35. 35. Database Design & Development Dec 2010 Final ©NCC Education 2010 International AdvancedDiploma in Computer Studies Database Design & Development TASK-5 Assumptions: I assume some entities to remove data redundancy on this database. I think this was the best move toward of analyzing, designing and implementing. If I never do that on this database it could be difficult & data can be duplicated. That the reason I made many to many relationship. I think that was a best way to develop this database completely. Summary: To developing this database I collect some valuable experience which is helpful & I think that will be help in my practical life when I doing job. This database related to practical life, so I like it very much & when I made it I feel so happy.

×