In SQLite, the ceil()
and ceiling()
functions are used to return the smallest integer that is greater than or equal to a given number. They both serve the same purpose, and either function can be used interchangeably.
Tag: functions
Understanding the RADIANS() Function in SQLite
The RADIANS()
function in SQLite is a mathematical function that converts an angle from degrees to radians. This can be handy when working with trigonometric calculations in your database queries, as some mathematical functions (such as SIN()
, TAN()
) expect angles in radians rather than degrees.
How ASIN() Works in SQLite
The ASIN()
function in SQLite calculates the arc sine (inverse sine) of a given numeric value. The result is the angle in radians whose sine is the specified number.
Understanding the ACOS() Function in SQLite
The ACOS()
function in SQLite is used to calculate the arc cosine (inverse cosine) of a given numeric value. The result is the angle in radians whose cosine is the specified number.
A Comparison of 6 SQL Rank Functions
SQL rank functions can be handy things to have when analysing data. Most major RDBMSs implement a similar bunch of ranking functions, usually with the same names. These rank functions allow us to assign rankings to rows based on specific criteria.
In this article, we’ll look at six commonly used SQL ranking functions, and observe how they differ. We’ll throw them all together into a single query and see their results side by side.
The rank functions in question are: ROW_NUMBER()
, RANK()
, DENSE_RANK()
, NTILE()
, PERCENT_RANK()
, and CUME_DIST()
.
4 Functions that Trim a String in PostgreSQL
PostgreSQL provides us with various string functions, including some that allow us to trim a given string on both sides or a given side.
Below are four functions that we can use to trim strings in PostgreSQL.
Continue readingUnderstanding the Difference Between SCALE(), MIN_SCALE() and TRIM_SCALE() in PostgreSQL
Anyone who looks at PostgreSQL’s list of mathematical functions will notice that there are some functions that have “scale” in their name. In particular, scale()
, min_scale()
, and trim_scale()
.
While these functions all have a similar name, they each have a different purpose. That said, they’re all related to the scale of the given number. The scale is the number of digits to the right of the decimal point in a number. For example, the number 1.95 has a scale of 2, and 1.958 has a scale of 3.
Continue readingList of Array Functions in PostgreSQL
Below is an alphabetical list of functions that we can use when working with arrays in PostgreSQL.
Continue readingA Quick Look at the FACTORIAL() Function in PostgreSQL
In PostgreSQL, factorial()
is a mathematical function that returns the factorial of a given integer. We pass the integer (it accepts bigint
), and it returns the factorial as a numeric value.
In mathematics, the factorial is the product of all positive integers less than or equal to a given positive integer. It’s denoted by that integer and an exclamation point.
Continue readingA Quick Look at the MD5() Function in PostgreSQL
In PostgreSQL, the md5()
function computes the MD5 hash of the specific text, and outputs the result in hexadecimal.
We pass the text as an argument when calling the function.
Continue reading