Day: March 10, 2023

Section 9:95. Date Manipulation – Getting Current Date and Timestamp

CURRENT_DATE: The CURRENT_DATE function returns the current date in ‘yyyy-MM-dd’ format. The syntax for the CURRENT_DATE function is as follows CURRENT_DATE For example: SELECT CURRENT_DATE; — Returns ‘2023-03-04’ (assuming today’s date is March 4, 2023) CURRENT_TIMESTAMP: The CURRENT_TIMESTAMP function returns the current timestamp in ‘yyyy-MM-dd HH:mm:ss’ format.  The syntax for the CURRENT_TIMESTAMP function is as …

Section 9:95. Date Manipulation – Getting Current Date and Timestamp Read More »

Section 9:94. String Manipulation – Reversing and concatenating multiple strings

In Hive, you can manipulate strings by reversing and concatenating them using built-in functions. REVERSE: The REVERSE function is used to reverse the characters in a string. The syntax for the REVERSE function is as follows REVERSE(input_string) For example: SELECT REVERSE(‘Hello World’); — Returns ‘dlroW olleH’ CONCAT: The CONCAT function is used to concatenate multiple …

Section 9:94. String Manipulation – Reversing and concatenating multiple strings Read More »

Section 9:93. String Manipulation – Trimming and Padding

In Hive, trimming and padding functions can be used to manipulate string data. TRIM: The TRIM function is used to remove leading and trailing whitespace or other specified characters from a string. The syntax for the TRIM function is as follows: TRIM([BOTH | LEADING | TRAILING] trim_character FROM input_string) BOTH: Removes the specified characters from …

Section 9:93. String Manipulation – Trimming and Padding Read More »

Section 9:92. String Manipulation – Substr and Split

1. SUBSTR: Extracts a substring from a given string. Example: SELECT SUBSTR(‘Hello World’, 1, 5); Output: Hello  Here is the example 2.In Hive, the SPLIT function is used to split a string into an array of substrings based on a delimiter. The syntax of the SPLIT function is as follows: SPLIT(string str, string delimiter) Here, …

Section 9:92. String Manipulation – Substr and Split Read More »

 Section 9:91. String Manipulation and Case conversion and Length

1.Case Conversion Functions: a. UPPER: Converts all characters in a string to uppercase. Example: SELECT UPPER(‘Hello World’); Output:` HELLO WORLD` b. LOWER: Converts all characters in a string to lowercase. Example: SELECT LOWER(‘Hello World’); Output: hello world c. INITCAP: Converts the first letter of each word in a string to uppercase. Example: SELECT INITCAP(‘hello world’); …

 Section 9:91. String Manipulation and Case conversion and Length Read More »

Section 9:90. Apache Hive – Overview of Functions

To validate functions in Hive, you can use the DESCRIBE FUNCTION statement. The DESCRIBE FUNCTION statement provides information about a specific function in Hive, including its syntax, parameters, and return type. You can also use the SHOW FUNCTIONS statement to list all the available functions in Hive.  SHOW FUNCTIONS; This output shows a list of …

Section 9:90. Apache Hive – Overview of Functions Read More »