mysqlsqllaraveldatabasemonday.com

What Should be database structure to create excel sheet like view? mean should tables store in json format or create tables for cells,rows and columns


Hi Everyone,

i want to create a board and all board will contain groups and each groups have tables(Rows and Columns), so should i save tables(Rows and Columns) as a json format or create separate table for rows,columns and cells etc?

i watn to create a system like monday.com


Solution

  • Depends on what kind of database you are using, if its a document database then JSON is the natural way, in a SQL database, the better way would be to have a table representing the rows, and having a separate table representing column mapping, this will give you the flexibility to add columns at will.

    For example:-

    Row Table

    | id | details       |
    |----|---------------|
    | 1  | row_1_details |
    | 2  | row_2_details |
    

    Column Table

    | id | column_name | column_value | row_id |
    |----|-------------|--------------|--------|
    | 1  | col_1       | skjdjks      | 1      |
    | 2  | col_2       | jslkds       | 1      |
    | 3  | col_1       | dhkshd       | 2      |