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

mysql alter 语句用法,添加、修改、删除字段等


//主键
alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
//增加一个新列
alter table t2 add d timestamp;
alter table infos add ex tinyint not null default '0';
//删除列
alter table t2 drop column c;
//重命名列
alter table t1 change a b integer;
//改变列的类型
alter table t1 change b b bigint not null;
alter table infos change list list tinyint not null default '0';
//重命名表
alter table t1 rename t2;
加索引
mysql> alter table tablename change depno depno int(5) not null;
mysql> alter table tablename add index 索引名 (字段名1[,字段名2 …]);
mysql> alter table tablename add index emp_name (name);
加主关键字的索引
mysql> alter table tablename add primary key(id);
加唯一限制条件的索引
mysql> alter table tablename add unique emp_name2(cardnumber);
删除某个索引
mysql>alter table tablename drop index emp_name;
修改表:
增加字段:
mysql> ALTER TABLE table_name ADD field_name field_type;
修改原字段名称及类型:
mysql> ALTER TABLE table_name CHANGE old_field_name new_field_name field_type;
删除字段:
mysql> ALTER TABLE table_name DROP field_name;


相关文档:

php学习笔记(9):Mysql简介和创建新的数据库

 
 一、MySql简介概要
MySQL是一个小型关系型数据库管理系统,开发者为瑞典MySQL AB公司,后来
被Sun公司收购,现在正在被甲骨文收购,支持FreeBSD、Linux、MAC、Windows
等多种操作系统 与其他的大型数据库例如Oracle、DB2、SQL Server等相比功能稍弱
一些  题外话:Postgresql&n ......

C#连接mysql数据库

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MySql ......

mysql 创建表并设置主键自增

mysql 创建表:
mysql> create table user(
    -> userid int(4) primary key not null auto_increment,
    -> username varchar(16) not null,
    -> userpassword varchar(32) not null
    -> );
create table log(
logid int(4) ......

linux mysql配置


卸载mysql
1、查找以前是否装有mysql
命令:rpm -qa|grep -i mysql
可以看到mysql的两个包:
mysql-4.1.12-3.RHEL4.1
mysqlclient10-3.23.58-4.RHEL4.1
2、删除mysql
删除命令:rpm -e --nodeps 包名
( rpm -ev mysql-4.1.12-3.RHEL4.1 )
3、删除老版本mysql的开发头文件和库
命令:rm -fr /usr/lib/mysql
r ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号