Remove or Trim First or Last Few Characters in MySQL Database with SQL Noņemt vai Trim Pirmā vai pēdējo rakstzīmes MySQL Database ar SQL
Another useful string function in MySQL database is TRIM() which will return a text string after removing the matching leading or trailing characters, also known as prefixes or suffixes. Vēl viens noderīgs string funkciju MySQL datubāze ir TRIM (), kas atgriezīsies teksta string pēc noņemšanas saskanīgumu vadošo vai trailing burtiem, kas pazīstams arī kā priedēkļus vai suffixes. It's been described by MySQL reference as function that returns the string str with all remstr prefixes or suffixes removed. Tas ir raksturota ar MySQL atsauce, kā funkcija, kas atgriež string str ar visām remstr priedēkļus vai suffixes noņemts. If none of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is assumed. Ja neviena no specifiers ABIEM, kā rezultātā, vai TRAILING ir dota gan tiek uzskatīts. remstr is optional and, if not specified, spaces are removed. remstr ir fakultatīvs, un, ja nav norādīts, telpas noņemta.
Syntax of TRIM(): Sintakses no TRIM ():
TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr FROM] str) TRIM ([(ABIEM | biotehnoloģijas | TRAILING) [remstr] no] str), TRIM ([remstr NO] str)
For example: Piemēram:
SELECT TRIM(' bar '); SELECT TRIM ( 'bar');
will return 'bar' (spaces dropped). būs atgriešanās "bar" (telpas samazinājās).
SELECT TRIM(LEADING 'x' FROM 'xxxbarxxx'); SELECT TRIM (Leading "x" no "xxxbarxxx ');
will return 'barxxx' (only leading x characters is removed). būs atgriešanās "barxxx" (tikai vadošās x rakstzīmes izņem).
SELECT TRIM(BOTH 'x' FROM 'xxxbarxxx'); SELECT TRIM (gan "x" no "xxxbarxxx ');
will return 'bar' (leading and trailing xs is dropped). būs atgriešanās "bar" (vadīšanu un trailing xs ir samazinājies).
SELECT TRIM(TRAILING 'xyz' FROM 'barxxyz'); SELECT TRIM (TRAILING "xyz" no "barxxyz ');
will return 'barx' (trailing xyz is cleared). būs atgriešanās "barx" (trailing xyz notīra).
This function is multi-byte safe. Šī funkcija ir multi-baits droši. And it can also be used with other SQL command such as UPDATE to perform modification update directly on database table data with SQL statements using tool such as phpMyAdmin. Un tas var izmantot arī ar citām SQL komandu, piemēram, UPDATE veikt izmaiņas update tieši datubāzē tabulas datus ar SQL pārskatus, lietojot instrumentu, piemēram, phpMyAdmin.
IMPORTANT : The page is machine translated and provided "as is" without warranty. SVARĪGI: Šī lapa ir mašīna tulkoto un ar nosacījumu ", kas ir" bez garantijas. Machine translation may be difficult to understand. Machine translation var būt grūti saprast. Please refer to Lūdzu, skatiet original English article oriģināls angļu rakstu whenever possible. kad vien iespējams.
Related Articles Saistītie raksti
- How to Find and Replace Text in MySQL Database using SQL Kā, lai atrastu un aizstātu tekstu MySQL datu bāzē, izmantojot SQL
- Check and Optimize MySQL Database Automatically with Crontab/Cron Pārbaudiet un Optimizējiet MySQL Database Automātiski ar Crontab / Cron
- MySQL Database Performance Tuning Best Practices Video Tutorial MySQL Database Performance Tuning Best Practices Video Tutorial
- Enable Logging of Slow Queries (Slow Query Log) in MySQL Database Enable iegrāmatošana Lēna vaicājumu (Lēna Query Log) in MySQL Database
- How to Remove and Drop Datafiles from Tablespace in Oracle Database Kā noņemt un Drop Datafiles no Tablespace in Oracle Database
- Uninstall and Remove Multiple Database Instances of Microsoft SQL Server 2005 Uninstall un Remove Multiple Database Gadījumi Microsoft SQL Server 2005
- How to Escape Characters in Oracle PL/SQL Queries Kā izvairīties no rakstzīmēm Oracle PL / SQL vaicājumu
- Change and Reset MySQL root Password Pārmaiņām un Reset MySQL root parole
- Change or Set MySQL Long Query Time Value for log-slow-queries Maina vai Set MySQL Long Query Time Vērtība, kam log-lēni queries
- WordPress MySQL SQL Query Error in WPDB Class WordPress MySQL SQL vaicājumu Kļūda WPDB klase









































