Select rowid along with all other columns from a table in Oracle database
To select rowid along with all other columns from a table, just use an alias and get the columns using asterisk (*).
How to get the size of the database in PostgreSQL?
SELECT pg_size_pretty( pg_database_size('dbname') );
Kill all blocking objects in Oracle database
To list down all blocking objects with status as ‘is blocking’, we can run the following query. There is a handy query that would frame ‘KILL’ queries for the blocking […]
ER_CANNOT_RETRIEVE_RSA_KEY – error when connecting to MySQL with MariaDB npm package. How to fix?
When you connect to a MySQL Database with MariaDB npm package you might face this error. To fix this just add “allowPublicKeyRetrieval”: true to your connection properties. In my case […]
Order a string column as an integer in Mysql
Use the following syntax to use a string/ varchar column as a number for ordering in MySQL. Example Here Box is of VARCHAR type. Hence I need to cast it […]
List active connection details in MariaDB
To list active connections and their details in MariaDB we can use the following queries. Using threads_connected Using processlist Using information_schema.processlist
Disallow empty values for a column in MySQL
To avoid a NULL value in a table column in MySQL we specify NOT NULL constraint when you create a table. But NOT NULL constraint still allows empty values. To […]
bad SQL grammar [SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?] Spring Boot / Spring Batch error. How to fix?
Reason for this error : Spring Boot / Spring Batch needs default tables where it can track the batch job related information. If the tables are not available in the […]
java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver] – Spring Boot / Spring Batch error. How to fix?
The reason for this error is you have missed MySQL dependency in your maven / gradle file. Add this in your build.gradle. In case of maven,
How to list all tables that contain a specific column name?
In this small post we are going to see how to list all tables that contain a specific column name. In MySQL sometimes you want to list down all tables […]
Create new table from select query result in MySql
In this post let’s learn how to create a new table in MySql using the output of a select query. You can create a new table from any select query […]
Handling NULL value in SQL
In this article we will quickly look how to handle the NULL value in an SQL table. A field with a NULL value is a field with no value. The […]
How to know the primary key column in Oracle?
In this quick tutorial we will see how to get the primary key column in the table. Here we can use the below table to list the columns ALL_CONSTRAINTS – […]
Alter table column size in Oracle
In this post, we will learn how to modify the size of an column in an Oracle table. It’s easy to alter the column size using the ALTER TABLE MODIFY statement. Sometimes […]
Oracle INSERT INTO SELECT
In this post, we will see how to insert a data into a table with the result of select statement. Sometimes we want to move the data from one table […]
Import CSV files into MySQL table
In this quick post, let’s see how to import data from csv formatted files into MySQL / MariaDB table. MySQL provides LOAD DATA LOCAL INFILE command to import data from […]
MySQL error – ..but as of v2.0 you must provide streamFactory option returning ReadStream – How to fix?
In this post we will take a look at how to resolve the MySQL error – Error: As a result of LOCAL INFILE command server wants to read emp.csv file, […]
ERROR 1017 (HY000): Can’t find file: ‘./….frm’ (errno: 13) – MySQL error. How to fix?
In this post we will take a look at resolving the MySQL error – ERROR 1017 (HY000): Can’t find file: ‘./….frm’ (errno: 13). Error no 13 is is probably due […]
How to temporarily disable a foreign key constraint in MySQL?
In this post you will learn how to temporarily disable foreign key constraints in MySQL Database. There are some scenarios where you have set foreign keys in a table but […]
How to delete duplicate rows from a table in Oracle SQL
In this article, we will see how to construct the single delete query to find and remove the duplicate rows from the table in Oracle SQL. Identifing and deleting the […]
Calculate size of the database in MySQL
Learn how to calculate the size of each database in MySQL. In MySQL the table data size and index length are stored in a table called TABLES in the database […]
Update random values from a list into a column in MySQL
Learn how to update random values from a list into a column in MySQL, Oracle SQL or SQL Server. Let’s say I want to update date from four different values […]
Bugzilla keeps asking for credentials while accessing administration – How to fix?
Find out how to fix the Bugzilla issue – Bugzilla keeps asking for credentials while accessing administration. Sometimes this error would also occur when you login to your Bugzilla from […]
Convert column names to lowercase in Oracle SQL query results
When you run a SELECT query on an Oracle database instance, it usually returns the results with column names in Uppercase. In some instances you might need to get the […]
Escape Single quote in SQL
Inserting string with special characters is a pain in the butt, it would seem. It’s easy to escape a string with single quote or ampersand in SQL statements. To escape […]