首先用户要对数据库有完全的权限,创建,删除表create table bak as (select * from cdb_threads group by subject having count(*)=1);创建一个数据库,把未重复的提取出来insert into bak (select * from cdb_threads group by subject having count(*)>
一:内容回顾数据的增insert into 表 values (值)insert into 表(字段,字段2) values (值,值2)insert into 表(字段,字段2) select 字段1,字段2 from 表2 一般用的不是特别多删delete from 表 where 条件;truncate table 表名; 可以清掉offset的数据改update 表 set 字段=值 where 条件;查select 字段 from 表 whe
最近有客户反应部分数据丢失,进入数据库后查看发现数据库查询表提示Table '.\Tablename\posts' is marked as crashed and should be repaired
进入mysql的bin目录,执行以下命令:
myisamchk -c -r /var/lib/databases/tables/poller_item.MYI
即可解决。
记录自己创建数据库,需要更具情况修改这是以一个学生查分系统作为例子:create table info( student_id int not null auto_increment, //会自动加值,而且是主键name char(10), password char(8) not null default "12345678", //设置默认值是chinese int
-- CREATE DATABASE IF NOT EXISTS sharding-test DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;CREATE DATABASE IF NOT EXISTS `sharding-test` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLL...