How do I export particular column in MySQL using phpmyadmin? - php

I do have thousands of website list and other info in MySQL database.
I want only website column named "web" to be exported to excel or text or csv.
I know how to export the whole data but dont know how to export particular column.

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)
It is easiest way as per me

In my case, I have a users table with 20k records. Then i export 20k email address using this technique. You don't need to write any query.
open your table (user_login) and click on the structure button
Select column which you want to export. In my case I need on email column so I selected the email column and then click on browse button.
After click on browse button scroll down the page and click on export button. which i mentioned in screen.
Final step
select your export format and click on the go button... :)
Thank you for reading this. I hope you get the solution

You can execute this query directly using 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
details - mysql select

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.

You could do a query like:SELECT web FROM table; and then just export that.

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.

Related

PHP Insert / Update a mysql table from HTML form

This is my first mysql table.
I use HTML form in order to insert datas into a mysql table.
When submited, the form calls a php script in order to add datas into the form.
Then, mySQL table could look as follow :
From this mySQL table how could i generate and display a HTML table sorted by "NEXT_EVENT" column ?
If i want go on step ahead, is there a way a let user click on an upward / downward arrow placed next to each column header (links) in order to get the HTML table sorted as the desired column ?
--
Once the table sorted, i need to generate a raw simple TXT file where the ID on very FIRST row and NEXT_EVENT values will be copied to.
ie, sort.txt :
the 2 fields are comma separed.
2, 1499005140
Many thanks for your help,
To have such a link next to the heading you can use jQuery plugin tablesorter. You can refer at
http://tablesorter.com/docs/
And for just executing a query for one column, you can use ORDER BY clause
Hope it helps

How to export only two columns from database table in Phpmyadmin?

I am pretty noob at databases yet.
I am trying to export two columns from table, ID and CONF_TEXT in txt file or any other format as ID, Conf_text (ex: 121,Conf text...).
Anyone done the same before?
Thank You.
Instead of using
SELECT * FROM 'conf'
use
SELECT ID,CONF_TEXT FROM 'conf'
and them export
Just click on the SQL tab of phpMyAdmin and fire the following query:
SELECT ID, CONF_TEXT INTO OUTFILE 'abc.txt' FROM conf;
Then go to your xampp/wamp/mamp folder, then go inside mysql folder then in the data folder just search for the 'abc.txt' file. (Just search for the file name in the search box once you are inside data folder of mysql, you will get your abc.txt file having the data of two columns). Similarly, to get the file in csv format, change the extension of from .txt to .csv
Hope this helps!!!

Export MySQL column aliases in phpMyadmin

I am currently moving from one ticketing system to another. The table columns are close but not quite. I can run a query that will change the column name to what I need. However, when I export I am getting the original column name.
Here is the query with alias:
SELECT u.id AS staff_id
FROM users AS u
This gives me what I need. However when I export it, it is showing the original column names. Is there a way to keep the alias when exporting?
Since you're using phpMyAdmin, you can quickly use the "Rename exported databases/tables/columns" feature to rename your table and/or columns when exporting. (I believe this feature was added with version 4.6.0).
On the export page, select the "Custom - display all possible options" radio button, then in the "Output" area look for the "Rename exported databases/tables/columns" checkbox, which opens an additional dialog where you can adjust these names.

How to export part of a table as SQL in Adminer?

In Adminer, I can export whole tables with the "Export" menu option. When I enter a query, I can export the results as .CSV or .TSV, but not as SQL.
Is there any option to do so? A plugin or a config switch?
Adminer doesn't offer SQL export of a general SQL query because the query may join more tables which would be impossible to export to SQL.
To export a subset of rows in a single table, go to the Select view of this table, filter the results as you wish and check the rows you want to export (or check 'whole result' to export all rows in the result). Then use the Export button under the table.
In current version it is possible with Search
Select column
Select SQL as mark
Into value field fill subquery IN (SELECT id FROM ...)
if you click on export then on that page see there is a radio button named dump. put no of rows you wanted to pick up and starting record index number. then you will get your expected result
Here is how I did this:
Go to Adminer-> Click on Dump in top left side.
Output-> check save radio button
Format-> check SQL radio button
Go to below Export button
Mark checkboxes of Tables (if you want to data then mark checked Data)
If you want 1 table then mark one checkbox of a table.
Click on Export button.
Here we go :), Coool ;)

Jquery grid,not working properly

am using the application in this link
http://www.jeasyui.com/tutorial/app/crud2.php.I have added one more column say like 'empno' in the database by using phpmyadmin(using wamp server).And when i refresh the page..the newly added column is not displaying in the grid..And also the grid is small..I want to increase the height.How?
Thank you verymuch
increase the height using this line :
<table id="dg" title="My Users" style="width:550px;height:250px" //edit table height
and for the undisplayed column i don't know why this is happening recheck if the column is inserted in the table again in wamp server

Categories