您的位置:首页 > 数据库 > MySQL

mysql个人笔记

2014-10-27 22:36 381 查看
show databases;

use dbname;

show tables;

desc tablename;

create table new_table (

id varchar(12) primary not null default 0,

name varchar(20),

age int,

area varchar(10)

);

insert into new_table(

id,name,age,area)

values

('12345','jim',21,'beijing');

drop table new_table;

增删插()

alter table new_table add
sex ;

导出数据表文件》》 select new_table from jxc into outfile 'd:/t.xlsx;'

select new_table from jxc into outfile 'd:/t.txt;'

( 解决乱码问题:select new_table from jxc into outfile 'd:/t.txt' CHARACTER SET gbk; OK)

使用查询结果创建表》》 首先说明MYSQL不支持:Select * Into new_table_name from old_table_name;

使用下面两个方法:

1、Create table new_table_name (Select * from old_table_name);

select * into new_table_name from old_table_name;

2、SELECT * INTO OUTFILE 'a.txt' FROM table_name;

LOAD DATA INFILE '/database/mysql/a.txt' INTO TABLE new_table_name;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: