mysql个人笔记

来源:互联网 发布:勒索病毒 开启端口 编辑:程序博客网 时间:2024/06/02 06:27
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; 

                                                                 


0 0
原创粉丝点击