mysql数据库学习――3,表的创建,删除和变更_MySQL

php中文网
发布: 2016-06-01 13:32:00
原创
1104人浏览过

bitsCN.com

mysql数据库学习——3,表的创建,删除和变更

 

MVM mall 网上购物系统
MVM mall 网上购物系统

采用 php+mysql 数据库方式运行的强大网上商店系统,执行效率高速度快,支持多语言,模板和代码分离,轻松创建属于自己的个性化用户界面 v3.5更新: 1).进一步静态化了活动商品. 2).提供了一些重要UFT-8转换文件 3).修复了除了网银在线支付其它支付显示错误的问题. 4).修改了LOGO广告管理,增加LOGO链接后主页LOGO路径错误的问题 5).修改了公告无法发布的问题,可能是打压

MVM mall 网上购物系统 0
查看详情 MVM mall 网上购物系统

表创建create table   mytbl(id   int    auto_increment  not null,name  char(10)  not null,birth  date     not null,wight  int,sex   enum('f','m'));指定数据库引擎的表创建create table     mytbl(id   int    auto_increment  not null,name  char(10)  not null,birth  date     not null,wight  int,sex   enum('f','m'))engine=memory;创建临时表create temporary  table   mytbl(id   int    auto_increment  not null,name  char(10)  not null,birth  date     not null,wight  int,sex   enum('f','m'));
登录后复制

 

复制数据表结构(也可以这样创建一个临时表作副本create  temporary table  tblnew  like   tblold)create table  tblnew  like   tblold同时复制数据insert into tblnew select * from tblold从查询结果创建表create  table  tblnew   select * from tblold
登录后复制

 

 

 

删除数据表

drop table tbl_namedrop table  tbl_name ,tbl2_namedrop table if exists  tbl_namedrop  temporary  table tbl_name
登录后复制

 

 

修改数据表

 

修改数据列的数据类型alter table mytbl modify  i   mediumint   unsignedalter  table  mytbl  chang i  i  mediumint   unsigned修改数据列的数据类型和字符集alter table mytbl modify  i   mediumint   character set  ucs2修改数据表的存储引擎alter table mytbl engine=engine_name
登录后复制

 

 

重命名数据表alter table tbl_name  rename to  new_tbl_namerename talbe  tbl_name to new_tbl_name重命名多个数据表 rename talbe  tbl_name to new_tbl_name,t1 to t2 ,t3  to t4移动数据表到另一个数据库alter table db1.tbl_name  rename to  db2.new_tbl_namerename talbe  db1.tbl_name to db2.new_tbl_name
登录后复制

 


bitsCN.com
相关标签:
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号