SQL Query Strategies: Handling NULL Values in Referee Filtering
Problem Context
The objective is to retrieve a list of customer names from a database table, specifically exclduing those who were referred by the customer with ID 2. A naive approach might involve a direct comparison operator in the WHERE clause.
SELECT name
FROM customer
WHERE referee_id <> 2;
However, executing this query often yiel ...
Posted on Sun, 07 Jun 2026 17:20:07 +0000 by ollmorris
Understanding MyBatis Caching: First-Level and Second-Level Cache Mechanisms
Introduction to Caching
Caching is a common feature in ORM frameworks, designed to enhance query performance and reduce database load by storing frequently accessed data in memory.
Cache Architecture
In the MyBatis source code, classes related to caching are located in the cache package. The core of this system is the Cache interface, with the ...
Posted on Thu, 04 Jun 2026 18:41:26 +0000 by jini01
Essential MySQL Command Parameters
1. Common mysql Command Options
1. --auto-rehash (tab completion for table names and fields)
# mysql -u root --auto-rehash
# vim my.cnf
[mysql]
auto-rehash
2. -B (disable history file, non-interactive mode)
# mysql -uroot -D test -e "show tables;" -B
3. -E (vertical output for query results)
# mysql -uroot -D test -e "sho ...
Posted on Wed, 03 Jun 2026 16:33:41 +0000 by Vinze
Calculating Capital Gains and Losses from Stock Transactions
The Stocks table schema is defined as follows:
Column Name
Type
stock_name
varchar
operation
enum
operation_day
int
price
int
The primary key for this table is the combination of stock_name and operation_day. The operation column is an enumeration containing ('Buy', 'Sell'). Each row represents a transaction made on a specific s ...
Posted on Tue, 02 Jun 2026 18:08:55 +0000 by hush2
Conditional Logic in MySQL Using CASE Expressions
Conditional Expression Syntax
MySQL supports two forms of conditional expressions using the CASE construct for implementing decision-making logic within queries.
Simple CASE Based on Column Values
The simple form compares a specific column's value against predefined constants:
CASE column_expression
WHEN constant_value_1 THEN return_value_1 ...
Posted on Tue, 02 Jun 2026 17:36:31 +0000 by pristanski
Apache Doris Weekly Troubleshooting Digest: SQL, DDL, and Cluster Operations
SQL Execution
Error E-3113 on long string columns in 2.1.x
Symptom
SELECT statements fail with [E-3113] string column length after upgrading to 2.1.0 or 2.1.1.
Fix
Raise the session variable parallel_pipeline_task_num. On a 32-core / 256 GB node:
SET parallel_pipeline_task_num = 16; -- or 32
JDBC catalog connection exhaustion
Symptom
Can not ...
Posted on Sun, 31 May 2026 00:16:23 +0000 by tmharrison
Practical Techniques for Creating and Managing MySQL Indexes
Creating Indexes in MySQL
Sample Table Definition
DROP TABLE IF EXISTS tag_info;
CREATE TABLE tag_info (
rec_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Record ID',
creator VARCHAR(64) DEFAULT '' COMMENT 'Creator',
create_ts DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time',
updater VARCHAR(64) DEFAULT ...
Posted on Sat, 30 May 2026 22:51:38 +0000 by frost
SQL Query Fundamentals: SELECT, WHERE, Aggregation, Grouping, Sorting, and Limiting
This document covers essential SQL query operations, including selectign data, filtering with conditions, aggregating results, grouping data, ordering output, and limiting the number of rows returned.
Basic SELECT Syntax
The fundamental SELECT statement retrieves data from a table. The * wildcard selects all columns, while specific column names ...
Posted on Thu, 28 May 2026 22:12:24 +0000 by merkinmuffley
Differences in NULL and Empty String Handling Between Oracle and MySQL
Oracle Database Behavior
In Oracle databases, the distinction between an empty string ('') and a NULL value is effectively nonexistent; the database engine interprets them identically. This behavior differs significantly from other relational database systems. To demonstrate this, we can create a test table and observe how Oracle processes thes ...
Posted on Thu, 28 May 2026 18:49:26 +0000 by gp177
Strategies for Rapid Generation of Million-Scale Test Datasets
When validating application performance and data-intensive features, engineers frequently require substantial datasets within their testing environments. Scenarios demanding high-volume data include stress-testing database query performance, verifying search algorithm accuracy across diverse records, validating ETL pipeline consistency, and con ...
Posted on Thu, 28 May 2026 17:46:34 +0000 by madonnazz