How can I edit a view using phpMyAdmin 3.2.4? - mysql

I need to simply edit a very complicated view in phpMyAdmin 3.2.4 but I cannot figure how to do that. Any suggestions?
Thanks!

To expand one what CheeseConQueso is saying, here are the entire steps to update a view using PHPMyAdmin:
Run the following query: SHOW CREATE VIEW your_view_name
Expand the options and choose Full Texts
Press Go
Copy entire contents of the Create View column.
Make changes to the query in the editor of your choice
Run the query directly (without the CREATE VIEW... syntax) to make sure it runs as you expect it to.
Once you're satisfied, click on your view in the list on the left to browse its data and then scroll all the way to the bottom where you'll see a CREATE VIEW link. Click that.
Place a check in the OR REPLACE field.
In the VIEW name put the name of the view you are going to update.
In the AS field put the contents of the query that you ran while testing (without the CREATE VIEW... syntax).
Press Go
Special thanks to CheesConQueso for their insightful answer.

In your database table list it should show View in Type column.
To edit View:
Click on your View in table list
Click on Structure tab
Click on Edit View under Check All
Hope this help
update: in PHPMyAdmin 4.x, it doesn't show View in Type, but you can still recognize it:
In Row column: It had zero Row
In Action column: It had greyed empty button
Of course it may be just an empty table, but when you open the structure, you will know whether it's a table or a view.

try running SHOW CREATE VIEW my_view_name in the sql portion of phpmyadmin and you will have a better idea of what is inside the view

Just export you view and you will have all SQL need to make some change on it.
Just need to add your change in SQL query for the view and change :
CREATE for CREATE OR REPLACE

Select your view in Bookmarked SQL query section then select Delete then click Go button.

Related

How To See SQL Code in phpmyadmin SQL Table

I am trying to see the manual SQL code for a table I created using the graphical user interface. Is there a way to do this and if so how?
use
SHOW CREATE TABLE tablename
see manual
nbk is correct that you would use the SHOW CREATE TABLE command, which is also implemented graphically in phpMyAdmin. From the database structure page (where you see a list of tables), click to select the checkbox for any tables you wish to see the syntax for and the use the "With selected:" dropdown menu on the page to pick "Show create".
It does the same thing, but using the phpMyAdmin interface.
"With selected:" dropdown on the table page
Output of "Show create"

Modifying table entries from LibreOffice Base, possible?

I've successfully connected LibreOffice Base with MySQL data base server. I've tested if I modify my table from host (free hosting service on internet) then the changes are reflected when refreshing the table object in LO Base.
But my question is, can I modify DB table directly from LO Base? I guess that it's possible using sql queries from LO Base, but how? Please give me some insights or tutorials. Thanks.
The normal way to alter a table:
Tools -> SQL
Enter an ALTER TABLE command and press Execute button.
A way that works, even though it complains that no result set is returned:
Create a query in SQL view.
Enter ALTER TABLE command.
Click button in toolbar to mark it as Run SQL command directly. Or Edit -> Run SQL command directly.
Close the query and double-click to run it.
My guess is it could be done with a macro as well, similar to https://forum.openoffice.org/en/forum/viewtopic.php?f=5&t=75763 but using ALTER TABLE.
For more ideas see https://forum.openoffice.org/en/forum/viewtopic.php?f=61&t=37687.
EDIT:
Inserting new row data in a form is easier than altering the table. First, make sure this works:
Double-click on your table under Tables.
Insert -> Record, or enter data in the last new row.
If Insert -> Record is disabled, then you need to set up the table for editing. Make sure that your connection to the database allows editing. Also the table must have a primary key.
Once you can insert records in Table view, it's time to create the form:
Under Forms, Use Wizard to Create Form.
Select your table and press >> to include all fields.
Click Finish.
Now you should be able to open the form and enter data into the final new row.
More complete instructions with examples are at http://www.open-of-course.org/courses/mod/url/view.php?id=786.

MySQL for Excel Add-In, failing to append

I am using the MySQL for Excel add-in. I have been using this for months to highlight a set of data and load it into my database.
I added a new table last week, and was successfully loading data into it using the same method. It stopped working. When I attempt to Append data, I get an error dialogue box that says "Cannot Find Column 30"...which happens to be the number (and therefore) last column in my table.
Some more information:
- If I highlight this same set of data and try to write it to another table, it will allow me to (even though I don't confirm and do it). I get past the error dialogue box to the Mapping dialogue box.
- I tried writing data from the previous table to this new problem table. I got the same error dialogue box.
This tells me that the problem is not with the data set. It is with the table.
I then deleted the table, all the connections and redid it from scratch. Still the same problem.
Where is this failing? Thank you.
ya even i had the same problem, even i tried the same way u did, like deleted the table recreated everything, it did not work, finally i tried to append some random table and went to "Advanced Options" at the bottom of the append pop up
in this u will see some "Stored Column mappings" and some mappings in it, now delete all of them and hit "Accept" now u can append the table
it will work
I know this is super old but I have a solution because it just happened to me.
Try append on different table. When box pops up click 'Advanced Options'
Then under column mapping uncheck both:
(Automatically store the column mapping for the given table) AND
(Reload stored column mapping for the select table automatically)
Then goto the Stored mappings tab and delete all the stored mappings
Click Accept and then rejoice you are free of that error for life.
best -J
If Excel does not show you the "Stored Column mappings" then connect to a MySQL table not used before in Excel, then retry the Append, the mapping will be shown. Then you can follow the answer provided by user3611272.
Problem will be resolved by doing below steps:
Select any table from Table other than your target table.
Click on Append Data
Press "Advanced Options"
Select tab "Stored Mappings"
Delete your target table mapping and Accept.
it will solve the issue.

Rearrange Column Order in Navicat

in navicat you can arrange the order of the columns but i have yet to find a way to sync the changes with the database. i saw a similar question here -> Rearrange column order in Sqlyog but haven't found anything similar in navicat. i have many tables that need to be fixed for export to excel and the order is important in the readability/presentation. typing out sql code for each move would be way too tedious. thanks in advance.
you can't do it in navicat , you have to run a sql query for that purpose
You can reorder columns using SQLyog. To change the sequence of columns in a table, select the table in the Object Browser and select Table -> More Table Operations -> Reorder Column(s) (Ctrl+Alt+R) from the popup menu.
Select any column and click Up or Down button to move the column up / down. Having re-sequenced the columns, click Re-Order to save the table with changed structure. The column data in the table gets re-arranged accordingly.
This is a really old question i Stumbled on going to answer just in case someone needs
Navicat provides the ability to change the column order in a table by using the design table feature
Either right click on the table name or press ctr-d on the top of the screen there are arrows to move a column up or down
By pressing on the SQL preview tab on the top you can actually see the ALTER TABLE statements navicat is going to run
You can also copy-paste this Statement and run on any other test database you may have or as a git migration
Its a good idea to always read the SQL Preview as some times Navicat may use DROP statements and you would want to take a backup before something like that

Is there a way to view past mysql queries with phpmyadmin?

I'm trying to track down a bug that's deleting rows in a mysql table.
For the life of me I can't track it down in my PHP code, so I'd like to work backwards by finding the actual mysql query that's removing the rows.
I logged in to phpmyadmin, but can't find a way to view the history of past sql operations.
Is there a way to view them in phpmyadmin?
Ok, so I actually stumbled across the answer.
phpMyAdmin does offer a brief history. If you click on the 'sql' icon just underneath the 'phpMyAdmin' logo, it'll open a new window. In the new window, just click on the 'history' tab.
That will give you the last twenty or so SQL operations.
There is a Console tab at the bottom of the SQL (query) screen. By default it is not expanded, but once clicked on it should expose tabs for Options, History and Clear. Click on history.
The Query history length is set from within Page Related Settings which found by clicking on the gear wheel at the top right of screen.
This is correct for PHP version 4.5.1-1
You just need to click on console at the bottom of the screen in phpMyAdmin and you will get the Executed history:
To view the past queries simply run this query in phpMyAdmin.
SELECT * FROM `mysql`.`general_log`
if it is not enabled, run the following two queries before running it.
SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 'ON';
I don't think phpMyAdmin lets you do that, but I'd like to hear I'm wrong.
On the other hand you can enable query logging in MySQL: The General Query Log
Yes, you can log queries to a special phpMyAdmin DB table.
See SQL_history.
I am using phpMyAdmin Server version: 5.1.41.
It offers possibility for view sql history through phpmyadmin.pma_history table.
You can search your query in this table.
pma_history table has below structure:
You have to click on query window just below the phpMyAdmin logo, a new window will open.
Just click on SQL History tab. There you can see history of SQL Queries.
OK so I know I'm a little late and some of the above answers are great stuff.
As little extra though, while in any PHPMyAdmin page:
Click SQL tab
Click 'Get auto saved query'
this will then show your last entered query.
I may be wrong, but I believe I've seen a list of previous SQL queries in the session file for phpmyadmin sessions
Here is a trick that some may find useful:
For Select queries (only), you can create Views, especially where you find yourself running the same select queries over and over e.g. in production support scenarios.
The main advantages of creating Views are:
they are resident within the database and therefore permanent
they can be shared across sessions and users
they provide all the usual benefits of working with tables
they can be queried further, just like tables e.g. to filter down the results further
as they are stored as queries under the hood, they do not add any overheads.
You can create a view easily by simply clicking the "Create view" link at the bottom of the results table display.
you can run your past mysql with run /PATH_PAST_MYSQL/bin/mysqld.exe
it run your last mysql and you can see it in phpmyadmin and other section of your system.
notice: stop your current mysql version.
S F My English.
why dont you use export, then click 'Custom - display all possible options' radio button, then choose your database, then go to Output and choose 'View output as text' just scroll down and Go. Voila!
There is a tool called Adminer which is capable of doing all phpmyadmin job packed in single tiny php file.
http://www.techinfobit.com/how-to-import-export-database-without-any-extra-installation/