在MYSQL的栏内建立表格 [英] create a table inside a column in MYSQL

查看:70
本文介绍了在MYSQL的栏内建立表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,如果我弄错了,但是有什么方法可以在MySql的列内创建表吗?

Apologies if I am mistaken, but is there any way to create a table inside a column in MySql?

简述:我有一个名为test_table的表,其中包含名为name test_column的列.现在,我想在test_column中创建一个表.这可能吗?

Brief: I have a table named test_table which contains a column named name test_column. Now I want to create a table inside test_column. Is this possible?

推荐答案

您将创建一个子"表,其ID在主表的列中被引用.您不会在列中创建表格".

You would create a "child" table with an id that is referenced in the column of the main table. You wouldn't create a "table" in a column.

例如

Table 1
columm_pk int
column_fk int

table 2
column_pk (this is what goes in table 1)
other columns as needed. 

然后,您只需根据该fk ID联接表.您可以在第一个表中具有多个fk列,这些列链接到不同的子表.您也可以在MySql中查看SET数据类型,尽管我不建议这样做.

then you just join the tables based on that fk id. You can have multiple fk column in the first table that link to different child tables. You can also look in to SET data types in MySql although I wouldn't recommend them.

顺便说一句,如果您的问题是MySql特有的,那么您不应该使用oracle标记.

btw, If your question is MySql specific then you shouldn't use the oracle tags.

这篇关于在MYSQL的栏内建立表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆