[code]MySQL命令行中常用命令使用方法简单总结如下:
1、
show databases; //显示所有的数据库
show tables; //显示所有的数据库
create database user1;
use user1;
create table friends
(
id int auto_increment,
name varchar(30) not null default 'NULL',
description varchar(50),
primary key (id)
);
desc friends; //显示表结构
select * from friends where id=2; //显示表记录
2、表结构操作:
alter table friends
add (age int );
alter table friends
modify name varchar(40) not null;
alter table friends
remove description;
3、表记录操作:
insert into friends (id,name,age)
values(1,"Rechel",45);
update friends
set age=40 where name like "Rec%";
delete from friends where id=1;[/code]
1、
show databases; //显示所有的数据库
show tables; //显示所有的数据库
create database user1;
use user1;
create table friends
(
id int auto_increment,
name varchar(30) not null default 'NULL',
description varchar(50),
primary key (id)
);
desc friends; //显示表结构
select * from friends where id=2; //显示表记录
2、表结构操作:
alter table friends
add (age int );
alter table friends
modify name varchar(40) not null;
alter table friends
remove description;
3、表记录操作:
insert into friends (id,name,age)
values(1,"Rechel",45);
update friends
set age=40 where name like "Rec%";
delete from friends where id=1;[/code]