Search code examples
mysqldatabase-designdatabase-normalization

Mysql table structure design for economic data


enter image description here

Dear all Mysql experts I am very new for Mysql, please providing me some guides here. I have data as shown in picture above, and I am trying to design table structure of Mysql to store those data and the data will be added over the years, which i dont want to record same indicator multiple times. at the moment i was thinking about split the data into 3 tables: indicator table to hole indicator name, data value table to hold data value and year and the geography table to hold provinces but i am not quite sure if that approach is right please giving me some shade of light. Thank you very much.


Solution

  • Because its a simple question that deserves a simple answer, here is a suggestion. As per the comments, the sample data you have given is ambiguous, but with assumptions this is it.

    From your data, it looks like Indicator, Category and Source are all attributes of the same entity. It also looks like there are an arbitrary number of provinces. If so then you are likely to have three tables

    Indicator(IndicatorID,IndicatorText,Category,Source)
    Province(ProvinceID,ProvinceName)
    YearValue(IndicatorID,ProvinceID,Year,Value)
    

    You would probably not store the national value, just add up the provinces.