当前位置: 代码迷 >> Java Web开发 >> 关于mysql的数据库和表的相关操作
  详细解决方案

关于mysql的数据库和表的相关操作

热度:308   发布时间:2007-06-20 18:53:41.0
关于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  

----------------解决方案--------------------------------------------------------
最好把你的教程传上来吧
----------------解决方案--------------------------------------------------------
我 这个是平时写程序时用到的,把常用的总结了下来,贴出来是因为一方面自己用到时可以方便查,另一方面也提供给那些需要的朋友。

----------------解决方案--------------------------------------------------------
  相关解决方案