in my table, there r some * like :
id name
1 aaa_***
2 abcddd
3 bbb_***
4 adaflkj
I wanna to change all * in this table to 9,
anybody who knows how to deal with * in Mysql.
Thanks,
Tanya
8 1437 Atli 5,058
Expert 4TB
The * character inside strings is treated like any other character, so you would have to replace it with some script, or manually, just like you would do with any other character.
This character is used by MySQL as a wildcard character. It can be used to replace table names or column names in places where you would like MySQL to use all available tables/columns.
For example: -
SELECT myTbl.* FROM myTbl;
-
GRANT ALL ON myDb.* to 'User';
-
The * character inside strings is treated like any other character, so you would have to replace it with some script, or manually, just like you would do with any other character.
This character is used by MySQL as a wildcard character. It can be used to replace table names or column names in places where you would like MySQL to use all available tables/columns.
For example: -
SELECT myTbl.* FROM myTbl;
-
GRANT ALL ON myDb.* to 'User';
-
Thanks for answering,
MySql use * as a wildcard character, this is the problem !
in a linux terminal , using " \ " before " * " means the character " * " itself instead of any other character, so I am wondering is there any similar way to do in MySql ?
Tanya
MySql use * as a wildcard character, this is the problem !
in a linux terminal , using " \ " before " * " means the character " * " itself instead of any other character, so I am wondering is there any similar way to do in MySql ?
If the * is in quotes or backticks, it won't get processed as a wildcard. In other words: - SELECT '*' FROM `someTable`
-
SELECT `*` FROM `someTable`
-
SELECT * FROM `someTable`
The first one will return one column, one row.
The second one will probably return an error, unless you have a field explicitly named `*` in `someTable`.
The third one will return all fields in `someTable`.
If the * is in quotes or backticks, it won't get processed as a wildcard. In other words: - SELECT '*' FROM `someTable`
-
SELECT `*` FROM `someTable`
-
SELECT * FROM `someTable`
The first one will return one column, one row.
The second one will probably return an error, unless you have a field explicitly named `*` in `someTable`.
The third one will return all fields in `someTable`.
Yes !
this is actually what I want to get !
but how about inside of a string ?
I tried these : code (mysql )
1- delete from fcst where name = '???_`***`' ;
2- delete from fcst where name = '???_'***'' ;
3- delete from fcst where name = '*_`***`' ;
but none works.
I wanna to delete all records which end with *** .
Tanya
Yes !
this is actually what I want to get !
but how about inside of a string ?
I tried these : code (mysql )
1- delete from fcst where name = '???_`***`' ;
2- delete from fcst where name = '???_'***'' ;
3- delete from fcst where name = '*_`***`' ;
but none works.
I wanna to delete all records which end with *** .
Tanya
Hi Tanya,
Try the following: -
DELETE FROM table_name
-
WHERE col_name LIKE '%***'
-
% will try to match zero or more characters. The WHERE clause specifies that the col_name should end with ***. Also note that I have used LIKE operator, if you try to use "=" in place of LIKE the query will delete only the records where the value of col_name is '%***'.
I hope this helps you.
Regards,
Pradeep
Hi Tanya,
Try the following: -
DELETE FROM table_name
-
WHERE col_name LIKE '%***'
-
% will try to match zero or more characters. The WHERE clause specifies that the col_name should end with ***. Also note that I have used LIKE operator, if you try to use "=" in place of LIKE the query will delete only the records where the value of col_name is '%***'.
I hope this helps you.
Regards,
Pradeep
Hi Pradeep,
I solved this problem, thank you so much !
Tanya
Hi Pradeep,
I solved this problem, thank you so much !
Tanya
Glad to help you.
Regards,
Pradeep
Sign in to post your reply or Sign up for a free account.
Similar topics
by: _mario lat |
last post by:
I'd like to deal (update, deal, insert....) a database (with tables and
relationship between these)
by a tool written in php.
I need to share and work on a database with other people.
I'd like to...
|
by: francescomoi |
last post by:
Hi.
I'm trying to build 'MySQL-python-1.2.0' on my Linux FC2:
----------------------------------
# export PATH=$PATH:/usr/local/mysql/bin/
# export mysqlclient=mysqlclient_r
# python setup.py...
|
by: mikey |
last post by:
Hi all,
I'm having great problems trying to install the latest MySQl RPM
package onto my Red Hat Linux OS.
There is already MySQL v 3.0 pre-installed with the RH Linux
distribution disk but I...
|
by: Mike Chirico |
last post by:
Interesting Things to Know about MySQL
Mike Chirico (mchirico@users.sourceforge.net)
Copyright (GPU Free Documentation License) 2004
Last Updated: Mon Jun 7 10:37:28 EDT 2004
The latest...
|
by: trihanhcie |
last post by:
I m currently working on a Unix server with a fedora 3 as an os
My current version of mysql is 3.23.58. I'd like to upgrade the version
to 5.0.18.
After downloading from MYSQL.COM the package on...
|
by: Richard |
last post by:
Hi All,
I'm running MySQL 5.0.15-nt running over WinXP-Pro/SP2. The following
group of commands and responses suggests to me that my installation of
MySQL is corrupted. Is there anyway I can...
|
by: manish deshpande |
last post by:
Hi,
When i'm installing MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm by the following command:
rpm -i MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm the following error is being shown:
...
|
by: menzies |
last post by:
Hi, I"m new to this forum, but I have been trying all day to install DBD::mysql onto my Intel MacBook. I've read lots of forums pages and none have gotten me to a successful 'make test' or a...
|
by: WebCM |
last post by:
There is a function: http://paste.ubuntu.com/21865
It needs GMT date in YYYY-MM-DD HH:MM:SS format - in SQL: datetime. If date is the same as today, the function returns "Today". There
is one...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |