SQL Server SHOW TABLES Equivalent

Every now and then I find myself typing SHOW TABLES in SQL Server, expecting to get a list of tables.

That would make perfect sense if I was using MySQL or MariaDB. But SQL Server/T-SQL doesn’t have a SHOW TABLES statement like MySQL or MariaDB, so it never works. And I keep forgetting. But fortunately, SQL Server does have alternatives.

Here are five options for getting a list of tables in SQL Server. These can be used whenever you’re trying to find that elusive SHOW TABLES statement in SQL Server.

Read more

SQLite INTERSECT Operator

In SQLite, the INTERSECT operator is used to create a compound SELECT statement that returns the intersection of the results of the left and right SELECT statements. In other words, it combines two queries, but returns only those rows that are returned in both queries.

Read more

Find All Non-Numeric Values in a Column in Oracle

If you ever encounter a character column that should be a numeric column, there’s always a possibility that it contains non-numeric data that you don’t know about.

In Oracle Database, you can run a query like the following to return non-numeric data from the column.

Read more

Fix “ERROR 1054 (42S22): Unknown column ‘colname’ in ‘order clause'” in MariaDB

If you’re getting error “ERROR 1054 (42S22): Unknown column ‘colname’ in ‘order clause’” in MariaDB, it may be that you’re trying to reference an aliased column by its column name.

This is a common error when running queries that join two or more tables. It can also happen when using operators such as UNION, INTERSECT, and EXCEPT.

Read more

MySQL TABLE Statement

In MySQL, the TABLE statement returns rows and columns of the given table.

The TABLE statement is similar to the SELECT statement, and it can be used as a kind of shorthand version of the SELECT statement.

The TABLE statement was introduced in MySQL 8.0.19.

Read more

VALUES Statement in MySQL

In MySQL, the VALUES statement returns a set of one or more rows as a table. Basically, it’s a table value constructor in accordance with the SQL standard, which also functions as a standalone SQL statement.

The VALUES statement was introduced in MySQL 8.0.19.

Read more