关于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