Fields in the user-defined data table

Source: Internet
Author: User
There is a need, such as the customer upload the previous Excel table or CSV file, import user table, is the user information, including the following columns: Nickname, city, birthday, order number, mobile number, etc.

But in our system, the existing User table fields are only nicknames, cities, etc., no birthdays, order numbers, cell phone numbers and other fields.

Can the client upload a file, read the table file and create a new table to store the field information that was not in the user's table?

Or do you serialize the field information that you don't already have into a specific field in the original user table? When rendering in the foreground, format this specific field and display it?

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

Reply content:

There is a need, such as the customer upload the previous Excel table or CSV file, import user table, is the user information, including the following columns: Nickname, city, birthday, order number, mobile number, etc.

But in our system, the existing User table fields are only nicknames, cities, etc., no birthdays, order numbers, cell phone numbers and other fields.

Can the client upload a file, read the table file and create a new table to store the field information that was not in the user's table?

Or do you serialize the field information that you don't already have into a specific field in the original user table? When rendering in the foreground, format this specific field and display it?

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

If the custom field is not sorted, the need to retrieve, or it is recommended to use large pieces of bar, the data of non-standard fields are all in JSON or array serialization format into a large piece, need to show the time to do formatted output.

If you have a sorting or retrieval requirement, you may need to combine some open source indexing software such as Apache Lucene to achieve the specific requirements.

There is another way, the code may logically be slightly more complex, storage efficiency will be very low, in fact, it is not recommended, but if you are not a huge amount of data, the problem is not big. The method is to create a sufficient number of tables (User_data), the field naming is common naming methods such as "Column1,column2" and so on, and then specifically set up a table to do the user's data field corresponding (User_data_columns), the format is as follows:

| UID | name | field |
| 101 | Birthday | Column1 |
| 101 | Mobile Phone number | Column5 |

To use, first read the corresponding field name and table field in the User_data_columns table, and then go to the User_data table to fetch the corresponding column data.

  • Related Article

    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.