日期:2014-05-16 浏览次数:20477 次
如果简单的使用如下sql语句可能会返回失败,失败的原因极有可能是已经存在这张数据表了。
create table sales3 ( id NUMERIC,sale_date datetime not null) PARTITION by range(TO_DAYS(sale_date)) ( PARTITION sales20140301 values less than(TO_DAYS('2014-03-01')), PARTITION sales20140401 values less than(TO_DAYS('2014-04-01')) )
执行时返回的提示语句如下:
[SQL] create table sales3 ( id NUMERIC,sale_date datetime not null) PARTITION by range(TO_DAYS(sale_date)) ( PARTITION sales20140301 values less than(TO_DAYS('2014-03-01')), PARTITION sales20140401 values less than(TO_DAYS('2014-04-01')) ) [Err] 1050 - Table 'sales3' already exists
create table IF NOT EXISTS sales3 ( id NUMERIC,sale_date datetime not null) PARTITION by range(TO_DAYS(sale_date)) ( PARTITION sales20140301 values less than(TO_DAYS('2014-03-01')), PARTITION sales20140401 values less than(TO_DAYS('2014-04-01')) )
[SQL] create table if not exists sales3 ( id NUMERIC,sale_date datetime not null) PARTITION by range(TO_DAYS(sale_date)) ( PARTITION sales20140301 values less than(TO_DAYS('2014-03-01')), PARTITION sales20140401 values less than(TO_DAYS('2014-04-01')) ) 受影响的行: 0 时间: 0.003ms