日期:2014-05-16  浏览次数:20780 次

mysql建库建表
建库:
create database db_name character set =utf8;
/*建立库db_name,默认字符集为utf8*/

建表:
create table tb_1 (id int auto_increment primary key, remark varchar(20)) engine=innodb default character set=utf8 auto_increment =100;
/*建立表tb_1,存储引擎为innodb,默认字符集为utf8,自增列开始值为100*/

create table tb_2 (id2 int auto_increment primary key, remark varchar(20)) engine=innodb default character set=utf8 auto_increment =100;

删表
DROP TABLE IF EXISTS `A`;

删库
drop database 库1

内联接:
select * from t1 inner join t2 where t1.id=t2.id2;

左联接:
select * from t1 left join t2 on t1.id=t2.id2;

右联接:
select * from t1 right join t2 on t1.id=t2.id2;

全联接:
select * from t1,t2 

导出数据表数据
mysqldump -uroot -p ugood_newspaper_db merchant_orders>aaa.sql;
ugood_newspaper_db数据库名,merchant_orders表名,aaa是导出文件名