Posts

Showing posts with the label sql-functions-in-oracle

Featured Post

Python map() and lambda() Use Cases and Examples

Image
 In Python, map() and lambda functions are often used together for functional programming. Here are some examples to illustrate how they work. Python map and lambda top use cases 1. Using map() with lambda The map() function applies a given function to all items in an iterable (like a list) and returns a map object (which can be converted to a list). Example: Doubling Numbers numbers = [ 1 , 2 , 3 , 4 , 5 ] doubled = list ( map ( lambda x: x * 2 , numbers)) print (doubled) # Output: [2, 4, 6, 8, 10] 2. Using map() to Convert Data Types Example: Converting Strings to Integers string_numbers = [ "1" , "2" , "3" , "4" , "5" ] integers = list ( map ( lambda x: int (x), string_numbers)) print (integers) # Output: [1, 2, 3, 4, 5] 3. Using map() with Multiple Iterables You can also use map() with more than one iterable. The lambda function can take multiple arguments. Example: Adding Two Lists Element-wise list1 = [ 1 , 2 , 3 ]

SQL Tester Ideas DATE, Numeric, CHAR, NULL

Image
I have shared top SQL Date functions along with Numeric, CHAR and NULL functions. List of Built-in Functions DATE-TIME functions Numeric functions Char functions Null-related functions 1. DATE/TIME functions SELECT p_code, launch_dt, CURRENT_DATE FROM product; CURRENT_DATE returns the CURRENT date. SELECT p_code, To_char(launch_dt, 'DD MONTH YYYY') reformatted_dt FROM product; TO_CHAR FUNCTION returns date IN char format. 2. Numeric functions SELECT p_code, price, (price - 20), Abs(price - 20.00) FROM product; ABS - FUNCTION returns the absolute value SELECT p_code, price, Round (price, 1) FROM product; ROUND FUNCTION - round TO 1 digit. SELECT p_code, price, Sign(price - 15) FROM product; SIGN FUNCTION - it returns the sign SELECT p_code, price, Trunc(price, 1) FROM product; TRUNC FUNCTION - truncates TO a certain number OF decimal places. 3. CHAR functions SELE