MySQL-base-1
来源:互联网 发布:淘宝开放平台如何赚钱 编辑:程序博客网 时间:2024/04/29 13:13
记录一下sql的一些操作
1. 表操作
//创建数据表$sql = "CREATE TABLE IF NOT EXISTS `$table` (`id` int(10) unsigned NOT NULL auto_increment,`name` varbinary(100) NOT NULL,`datetime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,`address` varbinary(30) default NULL,`password` varchar(100) NOT NULL DEFAULT '',PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ";
2. 添加列
//向数据库中添加一列,并指定为主键alter table test add new_field int(5) unsigned not null auto_increment, add primary key(new_field);//alter table test add new_field int(5) unsigned default 1 not null auto_increment, add primary key(new_field); //不能正常执行
3. 删除列
//删除数据表中id列alter table test drop column id;</span>
4. /重命名change
/*ALTER [ONLINE | OFFLINE] [IGNORE] TABLE tbl_name CHANGE [COLUMN] old_col_name new_col_name column_definition [FIRST|AFTER col_name]*/alter table test change new_field id varchar(1) ;</span>
5.重命名表
//重命名表名alter table test rename test1;</span>
0 0
- MySQL-base-1
- mysql base
- mysql-base
- mysql base funny sql
- MySQL Base Configration Instructions
- Base-Jsp-1-基本概念
- 14.3.1 Base types
- Option Base 1
- Option Base 1
- Global Memory Base(1)
- base lib 1 ----Timestamp
- Base分享系列(1)
- UI(base)-1
- Debug Knowledge Base 1
- JavaEE Servlet Base (1)
- 德州扑克 Base 1
- base
- Base
- codeigniter 连接oracle 执行insert语句时报错
- 蓝桥杯 ALGO-1 区间k大数查询(数组、排序)
- 安卓下载更新
- LeetCode 045 Jump Game II
- Git错误non-fast-forward后的冲突解决
- MySQL-base-1
- HSL色彩模式
- hdu5025 Saving Tang Monk bfs+状态压缩
- 游戏开发常用优秀辅助软件目录
- 显示屏参数
- mysql修改表、字段、库的字符集
- JNI/NDK开发指南(十)——JNI局部引用、全局引用和弱全局引用
- Hibernate中的Inverse和cascade属性配置
- Ubuntu 命令行 安装gradle