Inbuilt SQL functions

PHOTO EMBED

Tue Aug 15 2023 00:41:23 GMT+0000 (Coordinated Universal Time)

Saved by @vnmshenoy

SELECT id,text,length(text) AS text_length
FROM slogan

https://learnsql.com/course/standard-sql-functions/numeric-functions/simple-text-functions/lower
- length() or len() based on db's,
- Lower(),Upper()
- Concat() or ||   based on db's,
- initcap(), which will change the first letter of a text value to upper case and the rest to lower case. Works only on Postrge and Oracle
- substring(name, 2) . DB starts with second character.'TripCare' and y = 2, we'll get 'ripCare' .If the integer y you provide is larger than the whole string length, then you will get an empty string '' as a result.
- another substring function is also there which takes 3 parameters
substring(name, 2, 3) . 'TripCare' we will get 'rip' because we start at letter 2 (which is 'r') and take 3 of them('r', 'I' and 'p').
  * Again, if you start from a number which exceeds the length of the whole string, you will get an empty string. 
  * If the second number you provide is bigger than the length to the end of the string, the database will simply return the string until its end.
-replace -replace(x,y,z), which takes the string x and, if it finds the text y in the x, then y will be replaced with text z. 
  SELECT replace('young man','young','old');
  The function will look for 'young' in the string 'young man' and will replace it with 'old'. 

content_copyCOPY