You can use the following views to return a list of views in Oracle Database.
Continue readingAuthor: Ian
How to Change the Table Border Style in the psql Query Results
When using psql
to run queries against PostgreSQL, we can use the \pset border
and \pset linestyle
commands to change the border of the table that displays our results.
Oracle GROUP_CONCAT() Equivalent
Some RDBMSs have a GROUP_CONCAT()
function that allows you to return a query column as a delimited list (for example, a comma separated list). MySQL and MariaDB are two that have such a function.
PostgreSQL and SQL Server have similar functions called STRING_AGG()
.
Oracle, on the other hand, has the LISTAGG()
function that does pretty much the same thing (and perhaps more).
So you could say that LISTAGG()
is Oracle’s GROUP_CONCAT()
equivalent.
How to Check if a Table Exists in SQLite
In SQLite, we can query the sqlite_schema
table to find out whether a given table exists.
Prior to SQLite version 3.33.0, this table was referred to as sqlite_master
(it can still be referred to as such in subsequent releases for backwards compatibility).
How to Format Numbers with Commas in MySQL
We can use the FORMAT()
function in MySQL to format numbers into a more human readable format.
The function returns the number as a formatted string. It adds thousands separators and a decimal separator as required, and rounds the results to the given decimal position.
Continue readingHow to Export Oracle Query Results to a JSON File when using SQLcl
When using SQLcl with Oracle Database, you can export your query results to a JSON file with the SPOOL
command.
4 Ways to Check if a Table Exists in MariaDB
Here are four ways to check whether or not a table exists in a MariaDB database.
Continue reading5 Ways to Check if a Table Exists in PostgreSQL
Below are five ways to check if a table exists in a PostgreSQL database.
Continue reading4 Ways to List All Views in MySQL
Below are four ways to list out the views in a MySQL database using SQL or the command line.
Continue readingSHOW DATABASES Equivalent in SQL Server – sp_databases
There are several ways to show a list of databases in SQL Server. Probably the easiest way is to use the sp_databases
stored procedure.
The sp_databases
stored procedure is a kind of SQL Server equivalent to the SHOW DATABASES
command that can be used with DBMSs such as MySQL and MariaDB. OK, maybe they aren’t strictly equivalents, but based on their ease of use, they could be viewed as such from a user’s perspective.