MySQL数据导入到infobright中
来源:互联网 发布:湖南网络公关公司 编辑:程序博客网 时间:2024/06/06 13:17
1. 在mysql中建一张表:
mysql> create table guoqing(
-> id int,
-> guo char(10),
-> qing char(10)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.01 sec)
2. 插入数据:
mysql> insert into guoqing(id,guo,qing) values('10000','1000','1');
Query OK, 1 row affected (0.00 sec)
3. 将数据导出csv文件:
最优通用导出语句
mysql> select * from guoqing into outfile '/tmp/guoqing.csv' fields terminated by ',' optionally enclosed by '"' lines terminated by '\n';
Query OK, 1 row affected (0.00 sec)
其中optionally enclosed by '"'可以给导出的值加上双引号,避免值需要转义
官方关于可选fields参数
Use the TERMINATED BY sub clause to specify the character recognized as the separator (delimiter) between values. By default, a semicolon ';' is assumed to separate values.
Use the ENCLOSED BY sub clause to specify the character that begins and ends each string representing a text value. By default, a double quotation mark '"' is assumed to enclose each value. If the text values in the input fle do not use any enclosing characters, use the value 'NULL' in the ENCLOSED BY sub clause. Note that this is the same as using the empty string '' option in standard MySQL.
Use the ESCAPED BY sub clause to support special characters that may be imbedded within text felds.
4. 在infobright中建一个表:
参见官方手册中支持的数据类型
mysql> create table guoqing(
-> id int,
-> guo char(10),
-> qing char(10)
-> ) ENGINE=brighthouse DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.02 sec)
5. 导入csv到infobright表中:
导入前先确认字符集是否支持中文,如果不支持,设置字符集,防止中文乱码。
mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> set character_set_server = 'utf8';
Query OK, 0 rows affected (0.00 sec)
mysql> set character_set_database ='utf8';
Query OK, 0 rows affected (0.00 sec)
mysql> load data infile '/tmp/guoqing.csv' into table guoqing fields terminated by ',' optionally enclosed by '"' lines terminated by '\n';
Query OK, 1 row affected (0.04 sec)
Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
5,验证:
mysql> select * from guoqing;
+-------+------+------+
| id | guo | qing |
+-------+------+------+
| 10000 | 1000 | 1 |
+-------+------+------+
1 row in set (0.00 sec)
这样mysql中的数据就能导入到infobright中了。
- mysql数据导入到infobright中
- MySQL数据导入到infobright中
- infobright中导入数据避免特殊字符问题
- infobright中导入数据避免特殊字符问题
- infobright数据导入和导出
- mysql将数据导入到excel中
- 把Excel数据导入到MySQL中
- mysql的数据导入到redis中
- excel中数据导入到mysql数据库
- excel数据导入到mysql中
- 大批量导入数据到mysql中
- 将csv文件导入到infobright
- 把excel中的数据批量导入到mysql数据中
- 从MySQL到Infobright迁移的白皮书
- 使用sqoop将mysql中数据导入到hive中
- 将mysql中数据导入到hbase中出现 NoSuchMethodError
- Sqoop将MySQL中数据导入到Hive表中
- mysql infobright
- Hibernate 基本概念
- Spring Cloud OAuth2 & Zuul
- Python生成器实现杨辉三角
- 关于发送邮件提醒的错误:java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream
- WIN7 + VS2015环境下关于GLEW和GLFW的配置
- MySQL数据导入到infobright中
- 关于MySQL安装过程中遇到的问题
- ajax执行后台方法执行了两次
- 2017/9/14 (学习日记)(FAT12文件簇链的寻找)
- WamapServer Apache服务器起不来(非端口占用)
- NKOJ-3777 卡牌操作
- 只能在执行Render() 的过程中调用 RegisterForEventValidation
- 字符转数字不使用str.toInt方法转为整型
- HDU