新建一个表table   字段有:字段1  字段2  字段3  字段4
字段3里面我存的数据也是一张表 怎么存
字段三的表已经建好 名字是table3  
是修改字段3的数据类型吗?  默认的是varchar  应该改成什么?????

解决方案 »

  1.   

    举例说明要求
    insert into select ?
      

  2.   

    另建一个table3  表
    table表的 字段3设置为外键关联到table3表的id字段
      

  3.   

    table  :主索引   字段1  字段2  字段3      字段4
              id     姓名   性别   基本信息表   婚否
              1      张三    男    table3     未婚 
                2      李四    女    table4    已婚table3:主索引   字段1   字段2      字段3     
              id    年龄    工作单位    家庭住址
                1     20     某单位      某地
                 2     21     某单位      某地table4:和table3 类似  
               
      

  4.   


    create table table1(
    id int not null primary key,
    name varchar(20) not null,
    t int,
    index(t),
    foreign key(id) references table2(id)
    );create table table2(
    id int not null primary key,
    ...
    );关键:
    t int,
    index(t),
    foreign key(id) references table2(id)