0

I want to create database table using mysql for transport application. Here I want to add columns which are not fixed for every record. They are added dynamically for every record. For example, record 1 contains PoliceFees & StateBoundry whereas record 2 does not have these fields. record 3 might have some others fields and so on. So how to design table for such data??

2
  • Set default value to NULL, for the fields which may be empty Commented Mar 14, 2018 at 14:43
  • Use JSON data to store the 'optional' values. dev.mysql.com/doc/refman/5.7/en/json.html Commented Mar 14, 2018 at 14:45

1 Answer 1

1

Dynamic fields and MySQL (relational database)? I think no-SQL is a better solution to your problem.

But if that fields is all known you can create a table with all of them and set as nullable. So you only insert needed data.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.