Fields in a custom data table

Source: Internet
Author: User
There is a requirement, such as uploading a previous excel or csv file to the user table, which is user information, including the following columns: nickname, city, birthday, order number, mobile phone number, etc, however, in our system, the existing user table has only the nickname, city, etc., no birthday, order number ,... there is a requirement, such as uploading a previous excel or csv file to the user table, which is user information, including the following columns: nickname, city, birthday, order number, mobile phone number, etc,

However, in our system, the existing user table only has fields such as nickname, city, birthday, order number, and mobile phone number.

Can I ask the customer to read the table file and create a new table to store the field information that is not in the User table when uploading a file?

Or is there a specific field stored in the original user table after the field information is serialized? When the front table is present, Format this specific field and display it?

Which one is more feasible, or is there any other way?

Reply content:

There is a requirement, such as uploading a previous excel or csv file to the user table, which is user information, including the following columns: nickname, city, birthday, order number, mobile phone number, etc,

However, in our system, the existing user table only has fields such as nickname, city, birthday, order number, and mobile phone number.

Can I ask the customer to read the table file and create a new table to store the field information that is not in the User table when uploading a file?

Or is there a specific field stored in the original user table after the field information is serialized? When the front table is present, Format this specific field and display it?

Which one is more feasible, or is there any other way?

If the custom fields are not sorted and need to be retrieved, we recommend that you use a large field to store all the data of non-standard fields in JSON or array serialized format into a large field, you just need to format the output when you need to display it.

If you have sorting or retrieval requirements, you may need to use some open-source indexing software, such as Apache Lucene, to achieve this. See the specific requirements.

There is another way, the Code logic may be a little more complicated, and the storage efficiency will be very low. In fact, it is not recommended, but if you are not using massive data, the problem is not big. The method is to create a table (user_data) with enough fields. The field names are generally named like "column1, column2, create a table to correspond to user data fields (user_data_columns) in the following format:

| Uid | name | field |
| 101 | birthday | column1 |
| 101 | mobile phone number | column5 |

When necessary, read the corresponding field names and table fields from the user_data_columns table, and then retrieve the data of the corresponding column from the user_data table.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.