我有简单的两张表create table tb_dic_tmnl_model
(
tmnl_model_id number(10), --型号id
tmnl_model_name varchar2(20), --型号名称
tmnl_model_desc varchar2(20), --型号描述
tmnl_brand_id number(10), --品牌id
tmnl_brand_name varchar2(20), --品牌名称
tmnl_brand_desc varchar2(20) --品牌描述
)
insert into tb_dic_tmnl_model (TMNL_MODEL_ID, TMNL_MODEL_NAME, TMNL_MODEL_DESC, TMNL_BRAND_ID, TMNL_BRAND_NAME, TMNL_BRAND_DESC)
values (11, 'iphone4', 'iphone4', 1, 'iphone', 'iphone');insert into tb_dic_tmnl_model (TMNL_MODEL_ID, TMNL_MODEL_NAME, TMNL_MODEL_DESC, TMNL_BRAND_ID, TMNL_BRAND_NAME, TMNL_BRAND_DESC)
values (12, 'iphone5', 'iphone5', 1, 'iphone', 'iphone');insert into tb_dic_tmnl_model (TMNL_MODEL_ID, TMNL_MODEL_NAME, TMNL_MODEL_DESC, TMNL_BRAND_ID, TMNL_BRAND_NAME, TMNL_BRAND_DESC)
values (21, '三星Galaxy S4', '三星Galaxy S4', 2, '三星', '三星');insert into tb_dic_tmnl_model (TMNL_MODEL_ID, TMNL_MODEL_NAME, TMNL_MODEL_DESC, TMNL_BRAND_ID, TMNL_BRAND_NAME, TMNL_BRAND_DESC)
values (22, '三星Galaxy Note 2', '三星Galaxy Note 2', 2, '三星', '三星');
commit;create table phone
(
tmnl_brand_id number(10), --品牌id
tmnl_model_id number(10) --型号id
)phone表关联一下上面的维表,获取到对应的名称。
怎么造数据,才能使数据不是脏数据?
麻烦大神写一下具体的sql
造数据连动
(
tmnl_model_id number(10), --型号id
tmnl_model_name varchar2(20), --型号名称
tmnl_model_desc varchar2(20), --型号描述
tmnl_brand_id number(10), --品牌id
tmnl_brand_name varchar2(20), --品牌名称
tmnl_brand_desc varchar2(20) --品牌描述
)
insert into tb_dic_tmnl_model (TMNL_MODEL_ID, TMNL_MODEL_NAME, TMNL_MODEL_DESC, TMNL_BRAND_ID, TMNL_BRAND_NAME, TMNL_BRAND_DESC)
values (11, 'iphone4', 'iphone4', 1, 'iphone', 'iphone');insert into tb_dic_tmnl_model (TMNL_MODEL_ID, TMNL_MODEL_NAME, TMNL_MODEL_DESC, TMNL_BRAND_ID, TMNL_BRAND_NAME, TMNL_BRAND_DESC)
values (12, 'iphone5', 'iphone5', 1, 'iphone', 'iphone');insert into tb_dic_tmnl_model (TMNL_MODEL_ID, TMNL_MODEL_NAME, TMNL_MODEL_DESC, TMNL_BRAND_ID, TMNL_BRAND_NAME, TMNL_BRAND_DESC)
values (21, '三星Galaxy S4', '三星Galaxy S4', 2, '三星', '三星');insert into tb_dic_tmnl_model (TMNL_MODEL_ID, TMNL_MODEL_NAME, TMNL_MODEL_DESC, TMNL_BRAND_ID, TMNL_BRAND_NAME, TMNL_BRAND_DESC)
values (22, '三星Galaxy Note 2', '三星Galaxy Note 2', 2, '三星', '三星');
commit;create table phone
(
tmnl_brand_id number(10), --品牌id
tmnl_model_id number(10) --型号id
)phone表关联一下上面的维表,获取到对应的名称。
怎么造数据,才能使数据不是脏数据?
麻烦大神写一下具体的sql
造数据连动
一个品牌表,另一个是具体的手机表(型号表)品牌表字段(品牌id,品牌名称,品牌描述,……)
手机表(型号id,型号名称,所属品牌id,型号描述)然后第一个下拉框查品牌表,然后根据品牌查具体的手机型号