In Oracle Database, the RM
format element allows you to return the month in roman numerals when using the TO_CHAR()
function.
You can also use the fm
modifier to suppress any padding.
Database Management Systems
In Oracle Database, the RM
format element allows you to return the month in roman numerals when using the TO_CHAR()
function.
You can also use the fm
modifier to suppress any padding.
In SQL, the columns
information schema view, which returns information about columns, is an ISO standard view that is supported by most of the major RDBMSs. You can use this view to get information about a column’s data type.
Most of the major RDBMs also provide other methods for getting column information.
Here are examples of getting the data type of a column in various SQL databases.
Continue readingThe following MariaDB examples return only those rows that have numeric values in a given column.
These examples use the REGEXP
function to return values that match the specified pattern.
When using the TO_CHAR()
function to format a number in Oracle Database, you can use the B
format element to return blanks for the integer part of a fixed-point number when the integer part is zero.
This works regardless of zeros in the format model.
Continue readingIn MySQL, the SCHEMA()
function is a synonym for the DATABASE()
function. It returns the default (current) database name.
The result is returned as a string in the utf8
character set. If there is no default database, it returns NULL
.
If you ever need to find out which quarter a date belongs to in MariaDB, here are two functions that will allow you to do just that.
Continue readingIf you’re getting SQL Server error Msg 8117 with the message Operand data type varchar is invalid for sum operator, it’s because you’re passing the wrong data type to an operator or function.
In this case, the error indicates that we’re passing a string to the SUM()
function. The SUM()
function does not operate on strings. It only works on numeric types.
The same error (Msg 8117) can also occur in other contexts – it’s not limited to the SUM()
function.
Sometimes you might need to search a database table for only those rows that contain at least one number in a given column.
Strictly speaking, numbers can be represented by words and other symbols, but for the purpose of this article, “number” means “numerical digit”.
Below is an example of how to use T-SQL to find rows that contain at least one number in SQL Server.
Continue readingIn PostgreSQL, the SUM()
function computes the sum of the non-null input values and returns the result.
In other words, it adds numbers and returns the result.
Continue readingWith Oracle Database, we can use the TO_CHAR(datetime)
function to return the century from a datetime value.
To do this, we can use either the CC
format element, or the SCC
format element. We can combine these with other format elements to do things like, display the ordinal number, spell out the century, etc.