分享

MySQL表操作

 忧郁_小刚 2011-04-15
MySQL学习笔记

删除表中的信息:
delete from youtable;
下面这条语句实现了从当地文件pet.in中向pet表中输入信息!
load data local infile '/home/liuzhouping/sql/pet.in' into table pet  lines terminated by  '\n';
mysql创建表
create table stu (stu_id int not NULL,stu_name char(20) not NULL,stu_sex char(10) not NULL)engine=innodb;
插入一行
innodb是一个可靠的事务处理引擎,他不支持全文本搜索;
insert into stu values ('1','xiaoxue','f');
alter table stu add stu_score char int; //增加一列
alter table stu drop stu_score;//删除stu_score字段
alter table stu modify stu_score bigint//改变列字段stu_score类型为bigint
alter table stu change stu_score stu_mark int;#这条语句实现了改变字段名stu_score为stu_mark并将其类型改为int
alter table stu change
删除特定的行

delete from stu where stu_name = 'name';
更新时所用的命令:update delete;
删除表drop table stu;
重命名表
rename table stu to student;
mysqladmin -u root -proot Var //显示服务器环境变量
mysqladmin -u root -proot ping //查看数据库是否在运行
存储引擎
MyISAM MyISAM是默认存储引擎。
InnoDB给MySQL提供了具有提交、回滚和崩溃恢复能力的事务安全存储引擎
InnoDB是为处理大量数据而设计的。
mysqlcheck -u root -proot -c -B mysql // 检查mysql数据库中所有的表
mysqldump -u root -proot -d ruanjian0701 stu > ./sql.sql //只保存mysql数据库中stu表的结构

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多