以存图片为例,我们可以这样写:
insert into picture(path, p_type, p_id ,size) values (binary_path, 0,vehicleInfoID,280);
insert into picture(path, p_type, p_id ,size) values (plateNum_path, 1, vehicleInfoID, plateNum_size);
insert into picture(path, p_type, p_id ,size) values (CarJpeg_1_path, 2, vehicleInfoID, CarJpeg_1_size);
insert into picture(path, p_type, p_id ,size) values (CarJpeg_2_path, 3, vehicleInfoID, CarJpeg_2_size);
insert into picture(path, p_type, p_id ,size) values (CarJpeg_3_path, 4, vehicleInfoID, CarJpeg_3_size);
也可以这样写:
insert into picture(path, p_type, p_id ,size,sizeplate,sizepicture2,sizepicture3) values (CarJpeg_1_path, 2, vehicleInfoID,CarJpeg_1_size, plateNum_size,CarJpeg_2_size,CarJpeg_3_size);
前者至少针对每一条记录,多冗余了4条记录,不可取。
更改字段的属性可以这么写:
alter table picture change path path varchar(150) default null;