您好,欢迎访问一九零五行业门户网

如果我们从包含 NULL 值的表中将数据导出到 CSV 文件,MySQL 如何评估?

如果我们从一个包含null值的表中导出数据,那么mysql将在csv文件中为具有null值的记录存储\n。可以通过以下示例说明:
示例假设我们想要导出表格'student_info'的值,该表格具有以下数据:
mysql> select * from student_info;+------+---------+------------+------------+| id | name | address | subject |+------+---------+------------+------------+| 101 | yashpal | amritsar | history || 105 | gaurav | chandigarh | literature || 125 | raman | shimla | computers || 130 | ram | jhansi | computers || 132 | shyam | chandigarh | economics || 133 | mohan | delhi | computers || 150 | saurabh | null | literature |+------+---------+------------+------------+7 rows in set (0.00 sec)
我们可以看到结果中 id 为 150 的地址字段有一个 null 值。现在以下查询将将此表的数据导出到 student_27.csv -
mysql> select * from student_info into outfile 'c:/mysql/bin/mysql-files/student_27.csv' fields terminated by ',';query ok, 7 rows affected (0.02 sec)
上述查询已将以下值存储在文件student_27.csv中 −
101 yashpal amritsar history105 gaurav chandigarh literature125 raman shimla computers130 ram jhansi computers132 shyam chandigarh economics133 mohan delhi computers150 saurabh \n literature
我们可以看到 mysql 在表有 null 值的地方存储 \n。
以上就是如果我们从包含 null 值的表中将数据导出到 csv 文件,mysql 如何评估?的详细内容。
其它类似信息

推荐信息