The log2()
function in SQLite calculates the base-2 logarithm of a given number.
This function can be useful for scenarios such as binary calculations, information theory, or situations where the base-2 logarithm is needed.
Continue readingThe log2()
function in SQLite calculates the base-2 logarithm of a given number.
This function can be useful for scenarios such as binary calculations, information theory, or situations where the base-2 logarithm is needed.
Continue readingThe good thing about having IDENTITY
columns in SQL Server is that they automatically generate a unique value for every row that’s inserted into a table. This saves us from having to insert our own unique values, and I’m not going to complain about that.
But obvious question you might ask; What if I need to know the value that was generated for each column I just inserted?
Fortunately, the solution may be easier than you think!
Continue readingThe tanh()
function in SQLite calculates the hyperbolic tangent of a number.
The hyperbolic tangent is the ratio of hyperbolic sine to hyperbolic cosine, producing values between -1 and 1.
Continue readingThe SQLite TRUNC()
function is used to truncate a number to an integer. It returns the integer part of its argument rounding toward zero.
TRUNC()
is similar to CEIL()
and FLOOR()
, except that TRUNC()
always rounds toward zero. CEIL()
on the other hand, always rounds up, and FLOOR()
always rounds down.
If you’re getting SQL Server error 137 that goes something like “Must declare the scalar variable…“, it’s probably because you’re referring to a variable that hasn’t been declared.
If the variable has been declared, it’s possible you’re referring to it incorrectly in the code.
When we use a variable in SQL Server, we must declare the variable first.
To fix this issue, declare the variable. Also be sure to use the right syntax when using it.
Continue readingThe LOG()
function in SQLite calculates the logarithm of a given number to a specified base, with 10 being the default base.
This is helpful for logarithmic transformations or calculations requiring a specific base (e.g., base 10 for common logarithms or base 2 for binary logarithms).
Continue readingIn 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.
If you’re getting MySQL error 1066 which reads something like “1066 (42000): Not unique table/alias: ‘products’” when using the HANDLER
statement in MySQL, it could be that you’re trying to open a table that’s already open.
If this is the case, be sure to close the table before trying to open it again. Or simply continue working without opening the table again.
Continue readingThe 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.
The SERIAL
data type in PostgreSQL is a pseudo-type used to create an auto-incrementing sequence of integers for a column. It is commonly used for primary keys, as it eliminates the need to manually assign unique identifiers for each new record. PostgreSQL handles this by automatically creating a sequence object that supplies a unique number each time a new row is inserted.
PostgreSQL provides three SERIAL
types, each with two options for usage; which effectively equates to six different types. So basically, we have six options to choose from when creating a SERIAL
column.