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 7653741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:06:05+00:00 2026-05-31T12:06:05+00:00

I am designing a database for a real estate application. the basic structure of

  • 0

I am designing a database for a real estate application. the basic structure of the application is as follows.

A) the application consist of storing the records related to
real estate properties.

B) the properties are divided into categories and transaction type
(sale, rent, lease) etc.

c) categories is divided into subcategories.

take for example the following records exist.

Transaction = Rent , Sale, Lease.

Categories = Residential , Commercial , Industrial , Agricultural

SubCategories = Residential_Apartment (belongs to residential category)
                Villa/House (belongs to residential category)
                Commercial_OfficeSpace (belongs to commercial category)
                Commercial_Plot (belongs to commercial category)
                Industrial_Plot (belongs to industrial category)

i have to create a relationship between the propert and all three above to identify which property is being stored for example

Property with id:1 is Transaction:Rent, Category:Residential, Subcategory:Villa/House

Property with id:2 is Transaction:Sale, Category:Residential, Subcategory:Residential_Apartment

Property with id:3 is Transaction:Lease, Category:Commercial, Subcategory:Commercial_Officespace

my current table structure is as follows

CREATE TABLE IF NOT EXISTS `transaction` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `transactionName` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `categoryName` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `subcategory` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `subCategoryName` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `property` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(100) NOT NULL,
  `transaction_id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `subcategory_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

Edit:

My Question is.

seeing the relationship between them, is it the right way of storing the records? my main concern here is categories and subcategory table, as because right now i am not able to think about design flaw that may occur in future. i just want to know how would you store the records in table if you were told to design something similar. mainly the category and subcategory part.

  • 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-31T12:06:07+00:00Added an answer on May 31, 2026 at 12:06 pm

    It all depends on the business rules for the types. I am assuming a couple of rules for the below suggestion, if any are wrong, please let me know:

    • A property can have only one transaction type
    • A property can have multiple categories
    • A property can have multiple sub categories
    • A category cannot share its sub category with other categories (ie. (this is a bit contrived I know) if you want a subcategory of Residential_ZZZ under Residential, then you must create a totally new subcategory if you want a subcategory of the same name (Residential_ZZZ) under commercial.)

    Table design:

    Property
        ID
        TransactionType_ID
    
    TransactionType
        ID
    
    Category
        ID
    

    This is an inheritance structure btw

    SubCategory
        ID
        CategoryID
        Name
    
    Property_Category_List
        PropertyID
        CategoryID
    
    Property_SubCategory_List
        PropertyID
        SubCategoryID
    

    I think there is a way to clean up the category/sub category, but I cannot think of it at the moment, and it would depend on the business rules really.

    Under your current schema, you at least needed to have a way to tie the sub category to its existing category (done above by including the CategoryID. Also, your properties can only have one category and sub category since they only have the one column in property. If you plan on having multiple categories or sub categories, then you need the List/Map structure that I created in the last two tables. Those are the only two major changes here

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

Sidebar

Related Questions

I am designing a database for storing products and some properties belonging to them.
I'm designing my database and LINQ To SQL ASP.NET web application. Imagine I have
I am presently designing a database schema for use in a Rails 3.1 application.
I am designing database for a Forum kind of application. The use cases involves
Good Day, I'm currently designing database structure for a website of mine. I need
I'm designing a database application which stores simple contact information (First/Last Name etc.) and
I am designing a database for an ASP.NET MVC application. I'm an expert in
I'm designing a database in MySQL and PHP for a basic CMS. The CMS
I am designing database tables for a master-detail scenario. The specific requirement is that
When designing a database to use MVCC (Multi-Version Concurrency Control), you create tables with

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.