The COSH()
function in SQLite calculates the hyperbolic cosine of a number, which is similar to the regular cosine function, but for hyperbolic geometry.
Category: DBMS
Database Management Systems
Why the Primary Key Might Not Appear in PRAGMA index_list() in SQLite
In most relational database management systems (RDBMSs) the PRIMARY KEY
is used to define the unique row identifier for a table. But in SQLite, not all primary keys are handled the same way when it comes to indexing.
Depending on how the primary key is defined in a table, it may or may not show up in the list of indexes returned by the PRAGMA index_list()
command. In particular, when the primary key is an INTEGER PRIMARY KEY
, SQLite doesn’t explicitly create a separate index for it.
This article will explain why this happens and provide examples with different types of primary key definitions.
Continue readingAn Introduction to Strict Tables in SQLite
SQLite is widely known for its simplicity, flexibility, and lightweight architecture. One feature that sets it apart from most other SQL databases is its dynamic typing system, which allows columns in a table to store data of any type, regardless of their declared type.
While some developers welcome this departure from the traditional SQL approach, others find it extremely problematic, due to its non-enforcement of data types, which could potentially lead to data integrity issues.
Continue readingHow to Effectively “Back Up” All Deleted Rows When Using DELETE in SQL Server
Deleting rows in a SQL database can sometimes be a nerve-racking experience. What if you’re deleting the wrong rows? Or what if the business later tells you they want their data back?
Fortunately SQL Server provides us with an easy way to essentially “back up” any rows affected by a DELETE
operation to a table.
This article looks at using the OUTPUT ... INTO
clause to save a copy of deleted rows to another table.
Understanding the SQRT() Function in SQLite
In SQLite, the SQRT()
function calculates the square root of a number. It returns the value which, when multiplied by itself, equals the input number.
Note that SQLite returns NULL
if you try to calculate the square root of a negative number, NULL
, or a value of the wrong type.
How to Use SERIAL Functionality on Integer Types Like INT in MySQL
Perhaps you’re familiar with MySQL’s SERIAL
type, which is not actually a data type, but a shortcut for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
.
One restriction of SERIAL
is that it forces us to use the BIGINT
data type, which is fine if you think you’ll need the extra space. But what if you want the same attributes for a smaller integer type, like INT
or MEDIUMINT
for example?
Enter SERIAL DEFAULT VALUE
.
A Quick Look at SQLite’s ASINH() Function
The ASINH()
function in SQLite calculates the inverse hyperbolic sine of a given numeric value. The result is the value whose hyperbolic sine is the specified number.
Understanding SQLite’s PI() Function
The PI()
function in SQLite returns the mathematical constant π (pi), which is approximately 3.14159265358979. It is used to represent the ratio of the circumference of a circle to its diameter.
The PI()
function is commonly employed in mathematical computations, particularly in geometry, trigonometry, and other scientific calculations involving circles and angles.
Overview of the SQLite COS() Function
The COS()
function in SQLite calculates the cosine of a given angle. The angle must be specified in radians. The result is the cosine of the angle, which is a real number between -1 and 1.
How to Rename an Index in SQLite
In most DBMSs (including SQLite), we can create indexes to improve query performance by allowing faster access to data. However, you might occasionally need to rename an index for whatever reason, be it for clarity, consistency, organizational purposes, or some other reason.
Continue reading