There are two primary methods to view the tables in MySQL:
- The MYSQL SHOW TABLES command.
- Querying the Information_schema.tables table.
In this article, we are going to explore them both.Read More
The SQL DROP statement is a command that deletes existing database components or the entire databases with all their data permanently. There are other SQL commands with a similar effect (TRUNCATE or DELETE), but the specificity of the DROP command is that it deletes everything at once. For instance, DROP TABLE removes the table data, indexes, triggers, permissions, constraints – the entire schema of the table.
The DROP statement requires one to be extremely careful when using it. Once performed, it can’t be rolled back. The information is lost for good. The only chance to return the data will be to restore a backup. Still, in many cases, we have to apply DROP statements. This article will focus on such cases, the specific DROP variants, and how to use them safely.Read More
In some cases, we need to delete the entire database from the MySQL community server. This is simple but irreversible. Thus, the DROP DATABASE command must be used very carefully. The current article will highlight the specificities of the task and explain how to safely drop the MySQL database manually with the help of specialized tools. The following topics will be in the focus:
To insert data into a table having columns with default constraints, we can use the DEFAULT constraint to a default value in a table. This article will cover the following aspects:
You can delete column from table in SQL in different ways. The most popular of them are:
In addition to the above methods, we are going to explore the following use cases:
The DROP TABLE IF EXISTS statement is used to drop existing database objects. When we create a complex stored procedure, we might also make several intermediate tables (physical tables or temp tables) to store and process the data. Now, we must add the code that drops those intermediate tables in the stored procedure. Otherwise, we might receive an error.Read More
There are several methods of how to rebuild all indexes of all tables in SQL Server, among them:
In this article, we’ll explore these methods and illustrate them with practical examples.Read More
Not so long ago, I was working on a project where we needed to change the data type of a table. The table had millions of rows, and we decided to create a separate table using the existing table definition and insert the rows into that table. After exporting data into the new table, we renamed the old table, constraint, and indexes using the sp_rename stored procedure.
The current article is dedicated to the ways of renaming indexes. You can also read how to rename table in SQL.Read More