Updating a Part of string in MySQL - mysql

I want to know if it is possible to update a small part of string in MySQL. For example, you have 100 pages stored in MySQL table. In each page there is a link which labeled at "2010 Updates". You want to change the Label to "2011 Updates". Can we do that using MySQL Update statement???
Thank you so much

You could try this video http://www.sebastiansulinski.co.uk/tutorials/play/261
I would just do a select statement, and looping through it, running a regex on each row, then updating said row; but the video gives you another option.

Related

Mysql Workbench - The best way to organize running frequently used SQL queries while development

I'm a java dev who uses Mysql Workbench as a database client and IntelliJ IDEA as an IDE. Every day I do SQL queries to the database from 5 up to 50 times a day.
Is there a convenient way to save and re-run frequently used queries in Mysql Workbench/IntelliJ IDEA so that I can:
avoid typing a full query which has already been used again
smoothly access a list of queries I've already used (e.g by auto-completion)
If there is no way to do it using Mysql Workbench / IDEA, could you please advise any good tools providing this functionality?
Thanks!
Create Stored Procedures, one per query (or sequence of queries). Give them short names (to avoid needing auto-completion).
For example, to find out how many rows in table foo (SELECT COUNT(*) FROM foo;).
One-time setup:
DELIMITER //
CREATE PROCEDURE foo_ct
BEGIN;
SELECT COUNT(*) FROM foo;
END //
DELIMITER ;
Usage:
CALL foo_ct();
You can pass arguments in in order to make minor variations. Passing in a table name is somewhat complex, but numbers of dates, etc, are practical and probably easy.
If you have installed SQLyog for your mysql then you can use Favorites menu option in which you can save your query and in one click it will automatically writes the saved query on Query Editor.
The previous answers are correct - depending on the version of the Query Browser they are either called Favorites or Snippets - the problem being you can't create sub-folders to group them. And keeping tabs open is an option - but sometimes the browser 'dies' - and you're back to ground 0. So the obvious solution I came up with - create a database table! I have a few 'metadata' fields for descriptions - the project a query is associated to; problem the query solves; and the actual query.
You could keep your query library in an SQL file and load that when WB opens (it's automatically opened when you restart WB and that file was open on last close). When you want to run a specific query place the caret in it's text and press Ctrl+Enter (Cmd+Enter on Mac) to run only this query. The organization of that SQL file is totally up to you. You have more freedom than any "favorites" solution can give you. You can even have more than one file with grouped statements.
Additionally, MySQL Workbench has a query history (see the Output Tab), which is saved to disk, so you can return to a query even month's after you wrote it.

How to show image in table using mysql command line

I have tried to show photo in MySQL command line, but always unable to do. Although I can retrieve photo using JDBC.
I am beginner to learn JDBC using MySQL, so, please help me by giving answer.mysql code are given below
create database image;
use image;
create table imgtable(photo,BLOB);
insert into imgtable(photo) values(LOAD_FILE('D:\\pic.png'));
select *from imgtable;
I cannot find storage photo in imgtable, only show garbage. But why it occur like this, actually is it not possible to show in table. Please suggest a way.
Thank you.
Blob data types in mysql store the information in encoded form. Hence you can only see the result in garbage form which is not actually garbage but your image in encoded form.

How do I automatically clear output in MySQL workbench?

I'm trying to find the preference settings to have the output clear every time my statement or set of statements are executed. I would prefer this option instead of right clicking and clearing the output every time I want to. I just can't find it and I'm not sure it exists as an option.
There's no such thing like auto-clearing. If you want that implemented file a feature request in the MySQL bug system (http://bugs.mysql.com).

disable per-column ordering in MYSQL workbench?

When I use MySQL workbench and get a huge dataset, i find it annoying that if I accidentally click on a row, workbench tries to order the data by that row - generally taking several minutes to complete.
I'm of the opinion that if I wanted a dataset ordered a particular way, I would have used an order-by clause.
Is there any way to disable the behavior of ordering a dataset by clicking on a particular column?
Unfortunately I think you're out of luck in this regard, unless of course you download the source code for MySQL Workbench and change the way the UI behaves and add in an option to disable column ordering on click.
Source is available here. (Change the 'select platform' drop down to 'Source Code')

Can I create more than 1 table at a time in a SQLite query in Actionscript?

Whenever I try to create more than one table in actionscript, only the first one gets run.
I've been using a string for my query or embedding an external file with the SQL code, and every time AS seems to ignore everything after the first ;
Perhaps this is a feature of Actionscript and how it deals with databases and adding each table is a separate query, but is there a way to get around this? I like the idea of having my whole db CREATE statement set in one contained place.
It seems that multiple statements aren't supported in AIR SQLite commands. You might separate your scripts into statements and execute them sequentially.