Below are 4 functions that enable you to return the month from a date in MariaDB.
Continue readingTag: how to
DROP TABLE IF EXISTS Example in PostgreSQL
In PostgreSQL, we can use the IF EXISTS
clause of the DROP TABLE
statement to check whether the table exists or not before dropping it.
2 Ways to Return Just the Numeric Values from a SQLite Database Column
The following SQLite examples return only those rows that have numeric values in a given column.
Continue readingFix Msg 8116 “Argument data type varchar is invalid for argument 1 of session_context function” in SQL Server
If you’re getting SQL Server error Msg 8116 with the message Argument data type varchar is invalid for argument 1 of session_context function, it’s because you’re passing the wrong data type to a function – in this case the SESSION_CONTEXT()
function.
3 Ways to Return the Time Zone from a Datetime Value in Oracle
Below are three ways to return time zone information from a datetime value in Oracle Database.
Continue readingSet the Character Set and Collation of a Column in MariaDB
You can specify the character set and collation at various levels in MariaDB. You can specify them at the connection level, the server level, the database level, the table level, and even the column level.
You can also specify a collation in your queries so that it overrides any collation that has been previously specified at the aforementioned levels.
Continue reading2 Ways to List all Functions in MySQL
Below are two options we can use to return a list of functions in MySQL.
Continue readingAbout the RM Format Element in Oracle
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.
How to Check a Column’s Data Type in SQL
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 readingReturn Only Numeric Values in MariaDB
The 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.