1、找出当前存在的数据库
show databases;
use databasename;
show tables;
2、创建数据库
create database info;
use info;
3、创建一个数据库表
show tables;
create table mytable (name VARCHAR(20), sex CHAR(1), birth DATE, birthaddr VARCHAR(20));
describe mytable;
4、往表里加入记录
insert into mytable values (′hch′, ′f′,′ 1977-07-07′, ′china′);
select * from mytable;
5、用文本方式将数据导入
load data local infile "d:/mysql.txt" into table mytable;
输入数据按照每行,以tab分隔。
6、删除数据
delete from mytable where name="abccs";
delete from mytable;
7、更新数据
update mytable set sex='f' where name="tom";
8、删除表和数据库
drop table mytable;
drop database info;