SQL 4. String Functions

In this post, we are going to look at basic string functions in SQL. 1. UPPER, LOWER, LENGTH UPPER changes all lowercase alphabets to uppercase. LOWER changes all uppercase letters to lowercase. Finally, LENGTH gives the number of characters. The example is as follows: SELECT UPPER(first_name) LOWER(last_name) FROM customer WHERE LENGTH(first_name) > 10 The above code outputs the first names in uppercase and last names in lowercase from the table customer where the length of the first name is more than 10. ...

June 1, 2025 · map[name:Minjun Jeon]

SQL 5. Date and Time Functions

In this post, we are going to look at basic date and time functions in SQL. Before we dive deeper into the date and time functions, let’s look at standard date/time types. 0. Data/Time types Types Description Examples date Just date without time ‘2025-06-01’ time (with/without time zone) Just time without date ‘01:02:03.678+02’ timestamp (with/without time zone) Date and time ‘2022-11-28 01:02:03.678+02’ intervals Time interval ‘3 days 01:02:03.678’ 1. EXTRACT EXTRACT is used to extract parts of timestamp/date. The syntax is as follows: ...

June 1, 2025 · map[name:Minjun Jeon]

SQL 6. Numerical Functions and Operators

1. Operators Operator Description Examples Result + addition 4+3 7 - subtraction 5-3 2 * multiplication 4*2 8 / division (integer division truncates the result) 8/4 2 % modulo (remainder) 10%4 2 ^ exponentiation 2^3 8 For example, 9/4 will give 2 while 9.0/4 will give 2.2500...00. 2. Functions Function Description Examples Result abs(x) absolute value abs(-2) 2 round(x, d) round x to d decimal places round(7.4632, 2) 7.46 ceiling(x) round up to integer ceiling(7.4632) 8 floor(x) round down to integer floor(7.4632) 7

June 1, 2025 · map[name:Minjun Jeon]