In SQL Server we can create synonyms, which allow us to provide an alternative name for a database object. Once created, we can reference the synonym instead of the object itself.
Continue readingCategory: DBMS
Database Management Systems
Fix ERROR 1050 (42S01) “Table … already exists” in MySQL
If you’re getting an error that reads something like “ERROR 1050 (42S01): Table ‘customers’ already exists” when trying to create a table in MySQL, it’s probably because there’s already a table in the database with the same name.
To fix this issue, either change the name of the table you’re trying to create, or check the existing table to see if it’s the one you actually need.
Continue readingRedis ZRANGE Command Explained
In Redis, the ZRANGE
command returns the specified range of elements in the sorted set stored at the specified key.
It can perform different types of range queries: by index (rank), by the score, or by lexicographical order.
Continue reading3 Ways to Clone a Table in MariaDB using SQL
We have several options when it comes to using SQL to clone a table in MariaDB. And we have the option to clone the table with data, or without data.
Here are three SQL options for cloning a table in MariaDB.
Continue readingReturn All DEFAULT Constraints in a SQL Server Database (T-SQL)
In SQL Server, we can query the sys.default_constraints
system catalog view to return a list of DEFAULT
constraints in the current database.
Redis ZADD Command Explained
In Redis, the ZADD
command is used to add one or more members to a sorted set, or to update the score for members that already exist in the sorted set.
It returns the number of elements added to the sorted set, or the number of elements updated if the CH
argument is used.
How to Create a Sequence in SQL Server
SQL Server supports sequences. Sequences enable us to create our own sequence of numeric values.
Sequences are similar to identity columns in that they generate a unique value that can be used to identify a column. However, sequences are created completely independently of any table.
Continue readingList All Synonyms in a SQL Server Database (T-SQL)
In SQL Server, we can use the sys.synonyms
system catalog view to get a list of synonyms in the current database. This view returns all objects in the sys.objects
view of type SN
(which stands for synonym).
How to Move a Table to Another Schema in SQL Server
In SQL Server, if you ever need to move one or more tables to another schema, you can use the T-SQL ALTER SCHEMA
command.
Fix “ERR value is not an integer or out of range” When using the HRANDFIELD Command in Redis
If you’re getting an error that reads “ERR value is not an integer or out of range” when using the HRANDFIELD
command in Redis, it could be because you’re passing a second argument that isn’t an integer. Or if it is an integer, it could be out of range.