昨天作业
2013年4月20日星期六 09:56
Id 2 5 1 7 Class_name php0331 php0228 php0115 php0505 Id 1 2 3 4 5 Host_id 2 2 Guest_id 1 7 Match_time 2013-04-09 2013-03-29 Match_result 34:28 35:45
比赛时间 比赛结果 Select h.class_name, g.class_name, m.match_time, m.match_result From `match` as m left join class as h on m.host_id =h.id left join class as g on Php0331 Php0115 2013-04-09 34:28 m.guest_id=g.id where m.match_time between '2013-04-01' and '2013-04-30'; 主队 客队
select
2013年4月20日星期六 10:06
生成的文件格式:
默认的,采用行来区分记录,而采用制表符,来区分字段。
为了满足某种特别的需求,会采用不同的分割方式。
支持,在导出数据时,设置记录,与字段的分割符。
通过如下的选项: fields:设置字段选项
Lines: 设置行选项(记录选项) 先看默认值:
字段:fields terminated by '\\t' enclosed by '' escaped by '\\\\‘
记录:lines terminated by '\\n' starting by ''
可以自己设定:
select * into outfile 'e:/amp/three' fields terminated by ','
lines terminated by '\\n' starting by 'start:' from teacher_class where t_name = '韩信';
字段包裹
select * into outfile 'e:/amp/four'
fields terminated by '\\t' enclosed by 'x' lines terminated by '\\n' starting by 'start:' from teacher_class where t_name = '韩信';
注意:
常规的,所有的记录,应该通过行来显示 例外是保存二进制数据:
Blob binary
使用 into dumpfile
select * into dumpfile 'e:/amp/six' from teacher_class where t_name = '韩信' limit 1;
新增数据Insert&replace&loaddata
2013年4月20日星期六 10:37
Insert 插入
Insert into tbl_name (字段列表)values (值列表)
可以不将所有的字段都插入数据。
如果说需要完成部分字段的插入,需要必须存在 字段列表,没有插入的字段,使用默认值:
如果是插入部分字段, 可以使用下面的set语句:
用value的值列表语法,可以一次性插入多条数据: 每条数据采用记录构造符 括号完成即可:
相关推荐: