Here are eleven options for returning duplicate rows in Oracle Database when those rows have a primary key or some other unique identifier column and you want to ignore it.
Continue readingCategory: DBMS
Database Management Systems
Return Rows that Contain Non-Alphanumeric Characters in SQL Server
Here are examples of returning rows that contain non-alphanumeric characters in SQL Server.
Non-alphanumeric characters include punctuation characters like !@#&()–[{}]:;',?/*
and symbols like `~$^+=<>“
, as well as whitespace characters like the space or tab characters.
SQLite DATEADD() Equivalent
SQLite doesn’t have a DATEADD()
function like SQL Server (or an ADDDATE()
or ADD_DATE()
function like in some other DBMSs), but it does have the DATE()
function that can make additions to a date value.
SQLite also has a DATETIME()
function that can make additions to a datetime value (as well as a TIME()
function for time values).
4 Ways to List All Tables in a MySQL Database
Below are four ways to list out the tables in a MySQL database using SQL or the command line.
Continue reading3 Ways to Find Rows that Contain Uppercase Letters in SQLite
Here are three options for returning rows that contain uppercase characters in SQLite.
Continue readingVALUES Clause in SQL Server
In SQL Server, VALUES
is a table value constructor that specifies a set of row value expressions to be constructed into a table.
The VALUES
clause is often used with INSERT
statements to insert data, but it can also be used as a derived table in either the USING
clause of the MERGE
statement or the FROM
clause.
Fix “ERROR 1054 (42S22): Unknown column ‘…’ in ‘order clause'” when using UNION in MySQL
If you’re getting error “1054 (42S22): Unknown column ‘…’ in ‘order clause'” when using the UNION
clause in MySQL, it could be because you’re trying to reference an aliased column by its column name.
Subtract Days from a Date in PostgreSQL
We can subtract one or more days from a date in PostgreSQL with the -
operator.
Fix “ERROR 1136 (21S01): Column count doesn’t match value count at row 1” when Inserting Data in MySQL
One of the more common error message in MySQL goes like this: “ERROR 1136 (21S01): Column count doesn’t match value count at row 1“.
This error typically occurs when you’re trying to insert data into a table, but the number of columns that you’re trying to insert don’t match the number of columns in the table.
In other words, you’re either trying to insert too many columns, or not enough columns.
Continue reading11 Ways to Find Duplicate Rows while Ignoring the Primary Key in SQLite
Here are eleven options for returning duplicate rows in SQLite when those rows have a primary key or some other unique identifier column (but you want to ignore the primary key).
This means that the duplicate rows share exactly the same values across all columns with the exception of their primary key/unique ID column.
Continue reading