0% found this document useful (0 votes)
46 views3 pages

404 Bing

Uploaded by

Salifu Shahaban
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
46 views3 pages

404 Bing

Uploaded by

Salifu Shahaban
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
Powered by Al sa complex task that requires some knowledge of database design and Oracle SQL. I will try to help you as much as I can, but please note that this is not a complete or definitive solution. You may need to modify or improve it according to your specific requirements and preferences. a) Possible entities and their attributes are: Household: A group of people who live together and share common facilities. Attributes include household _id (primary key), structure_no, household _no, region_code, district_code, locality_code, sub_district, ea_code, ea_type, detailed_address, nhis_ecg_vra_other_no, hh_contact_phone!, hh_contact_phone2, date_started, date_completed, total_visits, type_of residence, status_a (number of usual members present), status_b (number of visitors present), status_c (number of usual members absent), status_a_plus_b (total number of persons present). Person: An individual who belongs to a houschold. Attributes include person_id (primary key), household_id (foreign key), name, relationship_code, sex, status (A, B or C), age, nationality_code, ethnicity_code, birthplace_code, religion_code, marital_status_code, literacy code, education_level_code, education_grade_code, occupation_code, industry_code, employment_status_code, employment_sector_code, disability_type_code(s), mobile_phone_ownership (yes or no), internet_usage (yes or no), children_ever_born_maie, children_ever_born_female, children_surviving_male, children_surviving_female, children_born_past_12_months_boy, children_born_past_I2_months_girl Emigrant: A former member of a household who has been living continuously for 6 months or more outside Ghana. Attributes include emigrant_id (primary key), household _id (foreign key), name, relationship_code, sex, age_at_departure, year_of_departure, activity_abroad_code, country_cod Crop: A type of crop or tree planting that a household cultivates for sale or family gain. Attributes include crop_id (primary key), household_id (foreign key), crop_type, erop_code, farm_size, measurement_unit_code, cropping_type_code. Livestock: A type of livestock or fishery that a household rears for sale or family gain, Attributes include livestock_id (primary key), household_id (foreign key), livestock_type, livestock_code, number. Dwelling: A type of dwelling that a household occupies. Attributes include dwelling_id (primary key), household_id (foreign key), dwelling_type_code, outer_wall_material_code, floor_material_code, roof_material_code, ownership_type_code, tenure_type_code, rooms_occupied, rooms_used_for_sleeping, shared_sleeping_toom (yes or no), number_of_houscholds_sharing_sleeping_room, lighting_source_code, drinking_water_source_code, other_water_source_code, cooking_fuel_source_code, cooking_space_type_code, bathing _facility_type_code, toilet_facility_type_code, shared_toilet_facility (yes or no), number_of households_sharing_toilet_facility, solid_waste_disposal_method_code, liquid_waste_disposal_method_code. b) Key fields and integrity constraints are: For each entity, the primary key is a unique identifier that cannot be null or duplicated. For example, household _id for Household entity and person_id for Person entity. For each entity that has a foreign key referencing another entity’s primary key, there is a referential integrity constraint that ensures that the foreign key value exists in the referenced table. For example, household_id in Person entity references household _id in Household entity. For each attribute that has a code value representing a predefined category or option, there is a domain integrity constraint that ensures that the code valuc is valid and consistent with the code list. For example, relationship_code in Person entity must be one of the values from 01 to 11 as defined in the questionnaire. For each attribute that has a numeric value representing a quantity or measurement, there is a range integrity constraint that ensures that the value is within a reasonable and realistic range. For example, age in Person entity must be between 0 and 99. For each attribute that has a date value representing a temporal event or period there is a format integrity constraint that ensures that the value follows a standard date format such as DD/MM/YYYY. For example date_started and date_completed in Household entity must follow this format. c) Normalization tables as may be necessary: * To normalize the tables we can apply the principles of first second and third normal forms (1 NF 2NF and 3NF) which aim to eliminate data redundancy and dependency anomalies. + INF requires that each attribute contains only atomic values and there are no repeating groups of attributes. To achieve this we can split the disability_type_codes attribute in Person entity into multiple attributes one for each type of disability (sight hearing speech physical intellectual emotional and other). Alternatively we can create a separate entity called Disability that has a composite primary key of person_id and disability_type_code and a many-to-many relationship with Person entity. + 2NF requires that cach attribute is fully functionally dependent on the primary key and there are no partial dependencies. To achieve this we can split the Dwelling entity into two entities: Dwelling and Dwelling_Type. Dwelling entity has the same primary key as Household entity (household _id) and contains the attributes that depend on household_id such as rooms_occupied rooms_used_for_sleeping shared_sleeping_room number_of_households_sharing_sleeping_room lighting source_code drinking_water_source_code other_ code cooking fuel_source_code cooking_space_type_code bathing facility_type_code toilet_facility type_code shared_toilet_facility number_of_households_sharing_toilet_facility solid_waste_disposal_method_code and liquid_waste_disposal_method_code. Dwelling_Type entity has a new primary key (dwelling_type_id) and contains the attributes that depend on dwelling type_id such as dwelling _type_code ‘outer_wall_material_code floor_material_code roof_material_code ownership_type_code and tenure_type_code. Dwelling entity has a foreign key (dwelling_type_id) referencing Dwelling Type entity. ‘+ INF requires that each attribute is directly dependent on the primary key and there are no transitive dependencies. To achieve this, we can split the Person entity into two entities: Person and Education, Person entity has the same primary key as before (person_id) and contains the attributes that depend on person_id such as household_id, name, relationship_code, sex, status, age, nationality_code, ethnicity_code, birthplace_code, réligion_code, marital_status_code, literacy_code, occupation_code, industry_code, employment_status_code, employment_sector_code, mobile_phone_ownership, intemet_usage, children_ever_born_male, children_ever_born_female, children_surviving_male, children_surviving_female, children_born_past_12_months_boy, children born_past_12_months_girl. Education entity has a new primary Key (education_id) and contains the attributes that depend on education_id such as education_level_code and education_grade_code. Person entity has a foreign key (education_id) referencing Education entity. 4) F/R model(s) of the relations, indicating their relationships’ + A possible E/R model is shown below: e) Oracle command to create two of the tables that have parent/child , indicate in your command ON DELETE, ON UPDATE clauses: + A possible Oracle command is: =- Create Household table as the parent table CREATE TABLE Household ( household_id VARCHAR(1) PRIMARY KEY, structure_no VARCHAR(1@), household_no VARCHAR(1@), region_code VARCHAR(2), district_code VARCHAR(2), locality_code VARCHAR(2), sub_district VARCHAR(5@), ea_code VARCHAR(18), ea_type VARCHAR(1), detailed address VARCHAR(100), nhis_ecg_vra_other_no VARCHAR(28), hh_contact_phone1 VARCHAR(15), hh_contact_phone2 VARCHAR(15), date_started DATE, date_conpleted DATE, total_visits NUMBER(2), type_of_residence NUMBER(1), status_a NUMBER(2), status_b NUMBER(2), status_c NUMBER(2), status_a plus b NUMBER(2) 3 -- Create Person table as the child table with a foreign key referencing Household table CREATE TABLE Person ( erson_id VARCHAR(1@) PRIMARY KEY, household_id VARCHAR(18) REFERENCES Household(household_id) ON DELETE CASCADE ON UPDATE CASCADE, name VARCHAR(5@), relationship_code VARCHAR(2), sex VARCHAR(Z), status VARCHAR(1), age NUNBER(2), nationality_code VARCHAR(2), ethnicity code VARCHAR(3) , birthplace _code VARCHAR(2), religion_code NUMBER(1), marital_status_code NUMBER(1), Literacy_code NUMBER(1), education_id VARCHAR(1@), -- foreign key referencing Education table (not shown here) ‘occupation_code VARCHAR(4), Industry_cade VARCHAR(4), enploynent_status_code NUMBER(1), enployment_sector_code NUMBER(1), sight disability VARCHAR(1), -- assuning disability attributes are split into multiple columns hearing disability VARCHAR(1), speech_disability VARCHAR(1), physical_disability VARCHAR(1), intellectual_disability VARCHAR(1), enotional_digability VARCHAR(1), other_disability VARCHAR(1),

You might also like