简体   繁体   English

从 mysql 数据库生成和打印数据的最佳方法是什么

[英]What is the best way to generate & print out data from mysql database

Let's say I want print out 1 mil user record from database to paper.假设我想将 1 百万用户记录从数据库打印到纸上。

The output format will be something like this. output 格式将是这样的。

No       Name    Address   Phone     Class  Teacher
----------------------------------------------------
1        John    123-etc   3214124   5      Miku
2        L.Gaga  123-etc   3214124   9      Koru
..
..
..
..
10000000 Puke    123123    3214124   2      Goku

What is the best method to print out this data without adding any limit to mysql query?在不对 mysql 查询添加任何限制的情况下打印出此数据的最佳方法是什么?

What I normally do in such a case, is using a tool like Navicat to write a query that gives me exactly the columns I need, ordered in the way I need them, and then use the export function of the tool to save the result in an Excel file.在这种情况下,我通常会使用 Navicat 之类的工具编写一个查询,该查询准确地提供了我需要的列,按照我需要的方式排序,然后使用该工具的 export function 将结果保存在Excel 文件。

That way I get all the Excel (or OpenOffice, for that matter) options for printing, including scaling to get as much records on one page as possible.这样我就可以获得所有 Excel(或 OpenOffice,就此而言)选项进行打印,包括缩放以在一页上获得尽可能多的记录。

You could query as normal and use PHP to write the results to a CSV file for further formatting, printing, etc. http://php.net/manual/en/function.fputcsv.php You could query as normal and use PHP to write the results to a CSV file for further formatting, printing, etc. http://php.net/manual/en/function.fputcsv.php

I don't think 1 million rows will be too much, but it will depend on your hardware (memory), environment (php timeouts), and the actual data.我认为 100 万行不会太多,但这取决于您的硬件(内存)、环境(php 超时)和实际数据。 The paper itself might be a problem, though.不过,论文本身可能是个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将html数据存储在mysql数据库中的最佳方法是什么? - What's the Best way to store html data in a mysql database? PHP / MySQL:从登录用户输入的数据库中获取过滤数据的最佳方法是什么? - PHP/ MySQL: What is the best way to get filtered data from a database that has been inputted by a logged in user? 考虑到速度和安全性,从MySQL调用数据的最佳方法是什么? - what is the best way to call data from MySQL with speed and security in mind? 从具有不同数据库的其他子域获取数据的最佳方法是什么? - What is the best way to get data from other subdomain with different database? 使用curl从数据库传输数据的最佳方法是什么 - What is the best way to transfer data from database using curl 从数据库检索数据并将其作为变量传递的最佳方法是什么 - What's the best way to retrieve data from a database and pass it as variables 对 MYSQL 数据库实施版本控制的最佳方法是什么? - What is the best way to implement versioning to a MYSQL database? 在mysql在线数据库中更新数据的最佳方式 - Best way to update data in mysql online database 将“其他”数据存储到 MySQL 数据库中的最佳方式 - Best way to store "Other" data into MySQL database 在MySQL数据库中存储数据的最佳方法 - Best way to store data in MySQL database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM