易截截图软件、单文件、免安装、纯绿色、仅160KB

Mysql修改表字段

#新增一个字段,默认值为0,非空,自动增长,主键  
 
   alter table tabelname add new_field_name field_type default 0 not null auto_increment ,add primary key (new_field_name);  
 
#增加一个新字段  
 
   alter table tableName add new_field_name field_type;  
   alter table tableName add new_field_name field_type not null default '0';  
 
#删除字段  
 
   alter table tableName drop column field_name;  
 
#重命名字段  
 
   alter table tableName change old_field_name new_field_name new_field_type;  
 
#改变字段的类型  
 
   alter table tableName change field_name field_name field_type;
#改变字段顺序
  alter table emp modify age int(3) first;
   
    alter table emp modify age int(3) after name;
 
   alter table users change user_group user_group VARCHAR( 10 )  after name ;
   
      //如果要提前就把原字段删除,再用first或after属性改
    现在数据库中有没有数据,如果没有数据可以这样做:  
  1。把该字段删除  
        alter   table   your_tablename   drop   电话号码  
  2。在添加该字段  
        alter   table   your_tablename   add   电话号码   first  
        如果该字段不为空且为主键  
        alter   table   your_tablename   add   电话号码   not   null   primary   key   first  
     


相关文档:

优化MYSQL数据库的方法

1、选取最适用的字段属性
  MySQL可以很好的支持大数据量的存取,但是一般说来,数据库中的表越小,在它上面执行的查询也就会越快。因此,在创建表的时候,为了获得更好的性能,我们可以将表中字段的宽度设得尽可能小。例如,在定义邮政编码这个字段时,如果将其设置为CHAR(255),显然给数据库增加了不必要的空间,甚至使 ......

php+mysql编码问题总结

要不出现乱码,就要保持数据库和页面的编码格式一致.我全部使用utf-8的编码.
首先页面:
 1. 将文件用UE打开,将文件另存为UTF-8无BOM格式.很多编辑器都可用.
 2.使用 header("content-type:text/html; charset=utf-8"); 强制转换成utf-8的编码.
   也可以新建一个head.php,如下,在页面中用include( ......

Mysql 学习笔记

 显示所有数据库 show databases;
 创建数据库 create dababase stu;
 删除数据库drop database stu;
 切换到数据库use stu;
 取得当前的数据库,带()表示函数:select database();
创建表(要切换到数据库中)
mysql> create table stu_info(
   
-> stu_id int(8) ......

nginx+php cgi+mysql一键安装包更新版

[part1] http://download.csdn.net/source/2076258 
[part2] http://download.csdn.net/source/2076272
[part3] http://download.csdn.net/source/2076276
[part4] http://download.csdn.net/source/2076283
[part02-04] http://www.ytgps.com/Images/nginx.rar
本文件体积过大分4个包,php-cgi+mysql+nginx.7z ......

Mysql文集

导入数据指定列
load data local infile 'D:\\service_func_utf8.txt' into table service_func fields terminated by '\t' (service_id, func_id1, func_id2, func_id3, func_id4, func_id5, func_id6);
MYSQL将查询结果导出到文件
select * from tablename into outfile '/tmp/test.txt';
MYSQL联合主键
create  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号