Skip to main content

address

Table: address

The address table stores detailed address information for various entities. It supports hierarchical geographic data, including city, town, union council (UC), and province details. The table also accommodates metadata such as high-risk population indicators, descriptions, and timestamps for auditing.


Columns

Column NameData TypeConstraintsDescription
addressIdint(11)NOT NULL AUTO_INCREMENTUnique identifier for the address.
address1varchar(255)Primary line of the address.
address2varchar(255)Secondary line of the address.
address3varchar(255)Tertiary line of the address.
address4varchar(255)Additional address details.
address5varchar(255)Additional address details.
districtvarchar(255)District of the address.
landmarkvarchar(255)Nearby landmark for better identification.
ucIdint(11)Identifier for the union council.
ucvarchar(255)Name of the union council.
addressTypevarchar(20)Type of the address (e.g., residential, office).
townIdint(11)Identifier for the town.
townvarchar(255)Name of the town.
cityIdint(11)Identifier for the city (foreign key).
cityNamevarchar(30)Name of the city.
countryvarchar(30)Country of the address.
highRiskPopulationtinyint(1)Indicator for high-risk population.
createdDatedatetimeDate the record was created.
descriptionvarchar(255)Additional description for the address.
lastEditedDatedatetimeLast modification timestamp.
latvarchar(255)Latitude coordinate of the address.
lonvarchar(255)Longitude coordinate of the address.
mappedIdint(11)NOT NULLMapped identifier linking to related records.
provincevarchar(30)Name of the province.
provinceIdint(11)Identifier for the province.
zipcodevarchar(15)Postal code of the address.
createdByUserIdint(11)User who created the record (foreign key).
lastEditedByUserIdint(11)User who last edited the record (foreign key).

Indexes

  1. address_mappedId_IdMapper_mappedId_FK - Index on mappedId for quick lookups linking to idmapper.
  2. address_lastEditedByUserId_user_mappedId_FK - Index on lastEditedByUserId for tracking edits.
  3. address_createdByUserId_user_mappedId_FK - Index on createdByUserId for tracking record creation.
  4. address_cityid - Index on cityId for faster lookups by city.
  5. address_createDate - Index on createdDate to support date-based queries.
  6. address_lastEditedDate - Index on lastEditedDate to assist with audit trails.
  7. idx_address_ucId - Index on ucId for union council queries.
  8. idx_address_townId - Index on townId for town-based lookups.

Foreign Key Relations

  1. address_createdByUserId_user_mappedId_FK
  • Links createdByUserId to the user table (mappedId).
  • Tracks which user created the address record.
  1. address_lastEditedByUserId_user_mappedId_FK
  • Links lastEditedByUserId to the user table (mappedId).
  • Tracks which user last edited the record.
  1. address_ibfk_1
  • Links cityId to the location table (locationId).
  • Associates the address with a specific city.
  1. address_mappedId_IdMapper_mappedId_FK
  • Links mappedId to the idmapper table (mappedId).
  • Provides a reference for related records.

Usage Notes

  • Geographic Hierarchy: The table supports a detailed geographic structure, enabling efficient address management at multiple levels, including city, town, and union council.
  • Audit Trail: Columns like createdDate, lastEditedDate, createdByUserId, and lastEditedByUserId facilitate tracking changes to records.
  • High-Risk Population: The highRiskPopulation column is useful for targeted interventions in specific areas.
  • Flexible Addressing: Multiple address columns provide room for extensive address descriptions and variations.
  • Mapped Relationships: The mappedId ensures easy integration with other related data models.