Remove or Trim First or Last Few Characters in MySQL Database with SQL הסרה או Trim ראשון או האחרונות תווים SQL עם מסד נתונים MySQL
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. פונקציה שימושית נוספת מחרוזת בתוך מסד הנתונים MySQL Trim () אשר יחזיר מחרוזת טקסט לאחר הסרת התאמה המוביל או נגרר תווים, הידוע גם בשם הקידומות או suffixes. It's been described by MySQL reference as function that returns the string str with all remstr prefixes or suffixes removed. היה שתוארו על ידי MySQL הפניה כפי פונקציה כי מחזיר את המחרוזת Str עם כל remstr הקידומות suffixes או להסירו. If none of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is assumed. אם אף אחד specifiers שני, בראש, או נגרר הוא נתון, גם היא להניח. remstr is optional and, if not specified, spaces are removed. remstr הוא אופציונלי, ואם לא צוין, רווחים יוסרו.
Syntax of TRIM(): תחביר של Trim ():
TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr FROM] str) Trim ([(שני | Leading | הדליה) [remstr] מתיבת] Str), Trim ([remstr FROM] Str)
For example: לדוגמה:
SELECT TRIM(' bar '); בחר Trim ( 'בר');
will return 'bar' (spaces dropped). יחזיר 'בר' (רווחים ירד).
SELECT TRIM(LEADING 'x' FROM 'xxxbarxxx'); בחר Trim (Leading 'x' מתוך 'xxxbarxxx');
will return 'barxxx' (only leading x characters is removed). יחזיר 'barxxx' (רק מוביל x מוסרת תווים).
SELECT TRIM(BOTH 'x' FROM 'xxxbarxxx'); בחר Trim (שני 'x' מתוך 'xxxbarxxx');
will return 'bar' (leading and trailing xs is dropped). יחזיר 'בר' (המובילה ו נגרר xs הוא ירד).
SELECT TRIM(TRAILING 'xyz' FROM 'barxxyz'); בחר Trim (הדליה 'XYZ' מתוך 'barxxyz');
will return 'barx' (trailing xyz is cleared). יחזיר 'barx' (הדליה XYZ נוקתה).
This function is multi-byte safe. פונקציה זו היא רבת בתים בטוחים. 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. וזה יכול לשמש גם עם אחרים כגון SQL הפקודה Update כדי לבצע שינויים ישירות על עדכון הנתונים בטבלת נתונים עם SQL תוחודל באמצעות כלי כמו phpMyAdmin.
IMPORTANT : The page is machine translated and provided "as is" without warranty. חשוב: הדף הוא מכונה בתרגום ובתנאי "כמות שהוא", ללא אחריות. Machine translation may be difficult to understand. תרגום מכונה יכול להיות קשה להבין. Please refer to אנא פנה ל original English article המאמר המקורי באנגלית whenever possible. ככל שניתן.
Related Articles מאמרים קשורים
- How to Find and Replace Text in MySQL Database using SQL כיצד למצוא ולהחליף טקסט MySQL מסד נתונים באמצעות SQL
- Check and Optimize MySQL Database Automatically with Crontab/Cron בדוק ומטב אוטומטית עם מסד נתונים MySQL Crontab / Cron
- MySQL Database Performance Tuning Best Practices Video Tutorial מסד נתונים MySQL כוונון ביצועים Best Practices וידאו ערכת הלימוד
- Enable Logging of Slow Queries (Slow Query Log) in MySQL Database אפשר רישום של שאילתות איטי (איטי שאילתה log) של מסד הנתונים MySQL
- How to Remove and Drop Datafiles from Tablespace in Oracle Database כיצד להסיר ולהתקין זרוק Datafiles מ Tablespace ב-Oracle Database
- Uninstall and Remove Multiple Database Instances of Microsoft SQL Server 2005 הסרת התקנה או הסרה של מספר המופעים של מסד נתונים Microsoft SQL Server 2005
- How to Escape Characters in Oracle PL/SQL Queries איך לברוח תווים Oracle PL / SQL שאילתות
- Change and Reset MySQL root Password שינוי סיסמה אפס MySQL שורש
- WordPress MySQL SQL Query Error in WPDB Class WordPress MySQL שגיאה שאילתת SQL ב-Class WPDB
- Change or Set MySQL Long Query Time Value for log-slow-queries שנה או בחר שאילתה זמן ארוך MySQL ערך עבור-Log-איטי שאילתות









































