![]() ORDER BY LENGTH( name) DESC Code language: SQL (Structured Query Language) ( sql ) It sorts the track names by their lengths: SELECT Name FROM The following statement returns all track names from the tracks table in the sample database. SELECT substr( 'SQLite substr', 8) Code language: SQL (Structured Query Language) ( sql ) substr('SQLite substr', 8) The following statement demonstrates how to use the substr function with only the first two arguments, the length argument is omitted. SQLite Code language: SQL (Structured Query Language) ( sql ) SELECT substr( 'SQLite substr', 7, -6) Code language: SQL (Structured Query Language) ( sql ) substr('SQLite substr', 7, -6) The following statement illustrates how to use the substr() function with a negative length argument. Substr Code language: SQL (Structured Query Language) ( sql ) SELECT substr( 'SQLite substr', - 6, 6) Code language: SQL (Structured Query Language) ( sql ) substr('SQLite substr', -6, 6) The following statement returns a substring from a string using a negative start argument. The following statement extracts and returns a substring from the SQLite substr string: SELECT substr( 'SQLite substr', 1, 6) Code language: SQL (Structured Query Language) ( sql ) substr('SQLite substr', 1, 6) If any argument is NULL, the substr() function will return NULL. If it is omitted, it is assumed to be the maximum positive integer. The length argument determines the length of the substring. The length argument is optional. ![]() See the following picture of a sample string with the positive and negative start
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |