[{FIELDS | COLUMNS} 字段
[TERMINATED BY 'string'] 字段之间分隔符号
[[OPTIONALLY] ENCLOSED BY 'char'] 字段被包含在char中间
[ESCAPED BY 'char'] 忽略字段里出现的char
]
[LINES
[STARTING BY 'string'] 忽略开头是string的行
[TERMINATED BY 'string'] 行分隔符
]
FROM test_table
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name'
[REPLACE | IGNORE] 遇到重复的时候处理方法,替换或者是忽略
INTO TABLE tbl_name 导入数据的目的表名
[PARTITION (partition_name,...)] 分区选择
[CHARACTER SET charset_name] 字符集
[{FIELDS | COLUMNS} 字段
[TERMINATED BY 'string'] 字段之间分隔符号
[[OPTIONALLY] ENCLOSED BY 'char'] 字段被包含在char中间
[ESCAPED BY 'char'] 忽略字段里出现的char
]
[LINES
[STARTING BY 'string'] 忽略开头是string的行
[TERMINATED BY 'string'] 行分隔符
]
[IGNORE number {LINES | ROWS}] 忽略行/列
[(col_name_or_user_var,...)] 目的表的表字段名或者用户变量名
[SET col_name = expr,...] 设置表字段值
怎么样合并?两个表字段是否一致?如果只是读取的话,可以加个视图,用union拼接
select column from a
union
select column from b
多表建立视图注意几个方面就可以了:
1、要为每个字段起名,且不能重复
2、可在create的时候把字段创建,也可以在select语句中写出字段的别名,且不可有公式之类的东西。
如:
create view 视图名as
select a.id,b.name from a,b where a.id=b.aid
或者
create view 视图名 (id,name)as
select a.id,b.name from a,b where a.id=b.aid
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)