Several useful SQL statements (Replace, Limit)

xiaoxiao2021-03-06  37

1, Replace:

Replace (Str, From_Str, TO_STR)

Return string

STR, its string

All the appearance of from_str

TO_STR instead.

MySQL> SELECT Replace ('www.mysql.com', 'w', 'ww');

-> 'wwwwww.mysql.com'

This function is reliable for multiple bytes. In fact, REPLACE uses the most for the Update statement, so that I am surprised that there is very little information on how to use Replace in Update, and I have been searched for a long time. I actually even give an example. An example is given. If you want to use Replace in Update, you don't have to work hard. The following example is the "111" in the Name field in Test to "111": mysql> Update Test Set Name = Replace (Name, "111" , "222"); 2, LIMIT uses the SELECT clause to take the result of the result of a large number of results, because of speed and efficiency, and other reasons, sometimes we don't want to take all the results, but only hope to take out some results, at this time We can use the LIMIT keyword, which is especially useful in using the paging acquisition result set. The following example is to display 1-10 records in the TEST table: mysql> SELECT * from Test Limit 1, 10;

转载请注明原文地址:https://www.9cbs.com/read-64025.html

New Post(0)