php 如何使用 phpmyadmin 在 MySQL 中导出特定列?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4486743/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I export particular column in MySQL using phpmyadmin?
提问by mathew
I do have thousands of website list and other info in MySQL database.
我在 MySQL 数据库中有数千个网站列表和其他信息。
I want only website column named "web" to be exported to excel or text or csv.
我只想将名为“web”的网站列导出到 excel 或 text 或 csv。
I know how to export the whole data but dont know how to export particular column.
我知道如何导出整个数据,但不知道如何导出特定列。
回答by Kinjalk
Query
询问
SELECT `web` FROM `yourtablename`
Or this to export unique records only:
或者仅导出唯一记录:
SELECT DISTINCT `web` FROM `yourtablename`
Then click export link given on bottom (in phpmyadmin)
然后单击底部给出的导出链接(在 phpmyadmin 中)
It is easiest way as per me
对我来说这是最简单的方法
回答by ajreal
You can execute this query directly using phpmysql :
您可以使用 phpmysql 直接执行此查询:
SELECT web FROM your_table INTO OUTFILE '/tmp/web.sql'
After that, you can login to the database server OR use php to access the OUTFILE
之后,您可以登录数据库服务器或使用php访问OUTFILE
details - mysql select
详细信息 - mysql 选择
回答by Mohsin Shoukat
open the table from which you want to export only certain column , click on structure , tick mark on check box of that column , click on browse button ! after that it will show you your column data , below their is written export button click on it ! don't click on export button which is at the top bar , now export your column by clicking on go Button.
打开您只想导出特定列的表,单击结构,在该列的复选框上打勾,单击浏览按钮!之后它会显示你的列数据,在它们下面写着导出按钮点击它!不要单击顶部栏中的导出按钮,现在单击 go 按钮导出您的列。
回答by jptsetung
Enter SELECT web FROM table;
and then click on the "Export" button that is at the bottom of the list. IMPORTANT, don't clic on the "Export" button at the top of the list, or you will export the whole data.
输入SELECT web FROM table;
然后单击列表底部的“导出”按钮。重要提示,请勿单击列表顶部的“导出”按钮,否则您将导出整个数据。
回答by Sean
You could do a query like:SELECT web FROM table;
and then just export that.
您可以执行如下查询:SELECT web FROM table;
然后将其导出。