When working with SQL Server, if we’re given a number that represents a date in the yyyymmdd format, we can use functions like CAST()
or CONVERT()
to convert that number to a valid date type. This will enable us to perform date operations against it that we might not be able to do when it’s still in numeric form.
Author: Ian
What is TCL?
When using relational database management systems (RDBMSs) we often hear terms like DDL, DML, DQL, DCL, and TCL. But what exactly are they?
In this article we’ll look at what TCL stands for in the context of SQL, and what it does.
Continue readingHow SERIAL Works in PostgreSQL
In PostgreSQL we can create auto-incrementing columns using the serial
data type. The serial
type causes the column to be automatically populated with an auto-incrementing value each time a new row is inserted. The same applies for the smallserial
and bigserial
types.
This article provides an overview of how these data types work.
Continue readingCreate an IDENTITY Column in PostgreSQL
Prior to PostgreSQL 10, if we wanted to create an auto-incrementing column, we would typically use the SERIAL
type, or we’d create our own sequence and apply it to an integer column.
But from PostgreSQL 10 onwards, we’ve been able to create identity columns.
Continue readingWhat is DCL?
When using relational database management systems (RDBMSs) we often hear terms like DDL, DML, DQL, TCL, and DCL. But what exactly are they?
In this article we’ll look at what DCL stands for in the context of SQL, and what it does.
Continue readingFix “Cannot drop a default constraint by DROP DEFAULT statement. Use ALTER TABLE to drop a constraint default.” in SQL Server
If you’re getting an error that reads something like “Cannot drop a default constraint by DROP DEFAULT statement. Use ALTER TABLE to drop a constraint default“, it’s because you’re trying to use DROP DEFAULT
to drop a DEFAULT
constraint.
The DROP DEFAULT
statement has been flagged for deletion from SQL Server, and Microsoft recommends that we use the ALTER TABLE
statement to drop DEFAULT
constraints.
Therefore, to fix this issue, use the ALTER TABLE
statement to drop the DEFAULT
constraint.
What is DQL?
We often hear terms like DDL, DML, DQL, TCL, and DCL when using relational database management systems (RDBMSs). But what exactly are they?
In this article we’ll look at what DQL stands for, and what it does.
Continue readingFix “ERR wrong number of arguments for ‘hstrlen’ command” in Redis
If you’re getting an error that reads “ERR wrong number of arguments for ‘hstrlen’ command“, it’s because you’re passing the wrong number of arguments when using the HSTRLEN
command.
The HSTRLEN
command requires two arguments (at the time of writing). These are the name of the key and the name of the field.
If you’re getting this error, check the number of arguments that you’re passing and adjust if required.
Continue readingWhat is DML?
We often hear terms like DDL, DML, DQL, and DCL when using relational database management systems (RDBMSs). But what exactly are they?
In this article we’ll look at what DML stands for, and what it does.
Continue readingFix “ERROR 1054 (42S22): Unknown column ‘…’ in ‘on clause'” in MySQL
If you’re getting an error in MySQL that reads something like “ERROR 1054 (42S22): Unknown column ‘c.DogName’ in ‘on clause”“, here are three likely causes:
- The column doesn’t exist.
- You’re trying to reference an aliased column by its column name.
- Or it could be the other way around. You could be referencing the column with an alias that was never declared.