showtables;droptableifexists tablename;CREATETABLE`table1`(`id`bigint(20)NOTNULLauto_incrementPRIMARYKEY,`dat`dateNOTNULLDEFAULT'0000-00-00',`aa_cnt`int(11)NOTNULLDEFAULT0COMMENT'aa统计量',`name`varchar(100))ENGINE=InnoDBDEFAULTCHARSET= utf8mb4 COMMENT='xx表';desc tablename;exit;/quit;truncatetable tablename;ALTERTABLE<表名>ADD<新字段名><数据类型>[约束条件];altertable oldname renameto newname;altertable tablename renamecolumn A to B;altertable tablename modifycolumn price decimal(18,4)notNULL;altertable tablename dropconstraint 约束名字;altertable tablename addconstraint 约束名字 default 默认值 for 字段名;
关于增删改查
select*from tablename;insertinto(fieldname1,fieldname2,fieldname3)values(可省略)(赋值1,赋值2,赋值3)deletefrom tablename where name="小明"update tablename set field1=new-value1,field2=new-value2 where name="小明";