| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 578 人关注过本帖
标题:关于mysql的数据库和表的相关操作
只看楼主 加入收藏
rongjing
Rank: 1
等 级:新手上路
帖 子:84
专家分:0
注 册:2007-3-24
收藏
 问题点数:0 回复次数:2 
关于mysql的数据库和表的相关操作
为数据库授权:
grant all privileges on handbook.* to 'admin'@'localhost' identified by 'iamtheadmin' with grant option;
创建表:
create table t_search (search_key1 varchar(50), search_key2 varchar(50), unit_flag int unsigned, description_flag int unsigned, method_flag int unsigned, use_description varchar(200));

插入数据:
insert into linear_matrix values(98, 'pressure', 'PSI, mm of Hg', 'Convert pressure from PSI to mm of Hg.', 'LinearEquation', 'not used', 'PSI_unit', 0.20, 20.2, 'NO', 98, 'PSI', 'mm', 98);

添加自动编号字段:
alter table hjy add column id int unsigned not null auto_increment primary key;
增加字段:
alter table publisher add column catalog varchar(200);
修改字段:
alter table linear_matrix change constant(old name) constant2(new name) float;
删除字段:
alter table TableName DROP Field_name_tobe_delete

更新数据:
update linear_matrix set unit_flag2=5 where use_description='Convert temperature from C to F.';
删除记录:
delete from table_name where column_name='';


退出mysql:
quit
搜索更多相关主题的帖子: 数据库 mysql 
2007-06-20 18:53
风月_无边
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:60
帖 子:2960
专家分:652
注 册:2007-1-19
收藏
得分:0 
最好把你的教程传上来吧

我的网站 http://www.
2007-06-21 10:56
rongjing
Rank: 1
等 级:新手上路
帖 子:84
专家分:0
注 册:2007-3-24
收藏
得分:0 
我 这个是平时写程序时用到的,把常用的总结了下来,贴出来是因为一方面自己用到时可以方便查,另一方面也提供给那些需要的朋友。
2007-06-21 11:26
快速回复:关于mysql的数据库和表的相关操作
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014911 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved