Would you like to ask if MySQL can store the results of the Select association table in the main table?
Source: Internet
Author: User
Keywordsmysqlphp database database design
is caused by this problem of how to store arrays in MySQL:
The solution to the problem of storage arrays is to do three tables, respectively, is the Uid,uid_hobby,hobby table, to check the hobby of a UID can only execute the select UID from uid_hobby where uid = XXX, It's troublesome to do it every time.
Would you like to ask if MySQL can store the result of the select of the associated table in the column of the main table? For example, there is a column of hobby in the UID table, and the contents of this column are the result of the select uid from uid_hobby where uid = 当前id sentence ""? Or is there a way to automate this query process? In the creation of the table when the corresponding relationship is set, so that when querying the main table can be a one-time query out, do not have to query again.
That is, in the select hobby from uid where uid = xxx, you can query directly to did corresponding hobby instead of executing the query on the associated table. The query for a table is done with a single table.
Reply content:
is caused by this problem of how to store arrays in MySQL:
The solution to the problem of storage arrays is to do three tables, respectively, is the Uid,uid_hobby,hobby table, to check the hobby of a UID can only execute the select UID from uid_hobby where uid = XXX, It's troublesome to do it every time.
Would you like to ask if MySQL can store the result of the select of the associated table in the column of the main table? For example, there is a column of hobby in the UID table, and the contents of this column are the result of the select uid from uid_hobby where uid = 当前id sentence ""? Or is there a way to automate this query process? In the creation of the table when the corresponding relationship is set, so that when querying the main table can be a one-time query out, do not have to query again.
That is, in the select hobby from uid where uid = xxx, you can query directly to did corresponding hobby instead of executing the query on the associated table. The query for a table is done with a single table.
select uid.* from (select uid from uid_hobby where hobby like '%游泳%') hobby_tb, uid where uid.id = hobby_tb.uid
I don't know how to understand that, right? If that's the case, you don't even have to create a field in the main table when you call it.
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.