LEFT() Function in MySQL Last Updated : 03 Oct, 2023 Comments Improve Suggest changes Like Article Like Report The LEFT() function in MySQL is used to extract a specified number of characters from the left side of a given string. It uses its second argument to decide, how many characters it should return. Syntax: LEFT (str, len)Parameter: This function accepts two parameters as mentioned above and described below : str: The given string from whose left side a number of characters are to be extracted. len: The number of characters to extract. If this parameter is larger than the number of characters in the string, this function will return the actual string. Returns: It returns a number of characters from a string (starting from left). Example 1: Applying LEFT() Function to a given string. SELECT LEFT("geeksforgeeks", 4) AS Left_Str;Output: Left_StrgeekExample 2: Applying Left() Function to a number. SELECT LEFT(12345678, 4) AS Left_Num;Output: Left_Num1234Example 3: Applying LEFT() Function to a given string when len > characters in the string. SELECT LEFT("geeksforgeeks", 20) AS Left_Str;Output : Left_StrgeeksforgeeksExample 4: Applying LEFT() Function to a column in a table. Table : Student_Details Student_IdStudent_NameStudent_Email1610110Aniket[email protected]1610111Nitin[email protected]1610112Sayantan[email protected]1610113Sanjay[email protected]SELECT Student_Name, LEFT(Student_Email, 9) AS Email_Name FROM Student_Details;Output: Student_NameEmail_NameAniketanike1001Nitinnitin5438Sayantansayan6975Sanjaysanjay506 Comment More infoAdvertise with us Next Article LEFT() Function in MySQL jana_sayantan Follow Improve Article Tags : SQL DBMS-SQL mysql Similar Reads LEAST() Function in MySQL The LEAST() function in MySQL is a versatile tool that returns the smallest (minimum) value from a list of expressions. It can be used with numbers, strings, or even columns of data to find the minimum value according to their data type.In this article, We will learn about LEAST() Function in MySQL 4 min read LN() Function in MySQL LN() function : It is the function in MySQL is used to calculate the natural logarithm of a specific number with base e . The number must be greater than 0, otherwise it will return NULL. Syntax : LN(X) Parameter : LN() function accepts one parameter as mentioned above in the syntax and described be 2 min read LTRIM() Function in MySQL LTRIM() : This function in MySQL is used to remove leading spaces from a string. Syntax : LTRIM(str) Parameter : It accepts one parameter as mentioned above and described below as follows. str â The string from which we want to remove leading spaces. Returns : It returns a string after truncating al 2 min read LOG() Function in MySQL LOG() function in MySQL is used to calculate the natural logarithm of a specific number. The number must be >0 Otherwise it will return NULL. Syntax : LOG(X) Parameter : This method accepts one parameter as mentioned above and described below : X : A number whose logarithm value we want to calcul 3 min read INSERT() function in MySQL INSERT() : This function in MySQL is used for inserting a string within a string, removing a number of characters from the original string. Syntax : INSERT(str, pos, len, newstr) Parameters : This method accepts four parameter. str - Original string in which we want to insert another string. pos - T 2 min read MySQL IF( ) Function The MySQL IF() function is a control flow function that returns different values based on the result of a condition. IF() Function in MySQLThe IF() function in MySQL returns a value if the condition is TRUE and another value if the condition is FALSE. The MySQL IF() function can return values that c 2 min read LPAD() Function in MySQL LPAD() function in MySQL is used to pad or add a string to the left side of the original string. Syntax : LPAD(str, len, padstr) Parameter : This function accepts three parameter as mentioned above and described below - str - The actual string which is to be padded. If the length of the original str 2 min read MID() function in MySQL MID() : This function in MySQL is used to extract a substring from a given input string. If the starting position is a positive number, then the substring of the given length will be extracted from the starting index. If negative, then the substring of the given length will be extracted from the end 2 min read MOD() Function in MySQL The MOD() function in MySQL is used to find the remainder of one number divided by another. The MOD() function returns the remainder of dividend divided by divisor. if the divisor is zero, it returns NULL. Syntax: MOD(N, M) or N % M or N MOD M Parameter : MOD() function accepts two parameter as ment 4 min read Like