Generate Event Sequence Numbers within a Specified Time Interval — From SQL to SPL #42Jun 23, 2025·2 min read
Query the Records Closest to the Specified Time Each Day — From SQL to SPL #43Problem Description & Analysis: A table in Oracle database has a column of datetime type, corresponding to multiple pieces of data per day: Task: Now we need to find two records every day, one closest to 8am that day and one closest to 8pm that day....Jun 26, 2025·1 min read
Search for Records Containing a Specified String Group in Multi Fields — From SQL to SPL #40Jun 18, 2025·2 min read
Add Records that Meet the Criteria before Each Group after Grouping — From SQL to SPL #39Jun 16, 2025·2 min read
Count Distinct within Intervals in Order — From SQL to SPL #38Problem Description & Analysis: The Teradata database table has three fields: date, account, and the name of the product purchased by the account. Task: Now we need to calculate how many types of products each account has purchased before each day, ...Jun 12, 2025·2 min read
Conditional Grouping — From SQL to SPL #37Problem Description & Analysis: A certain database table has multiple fields that can be grouped. Task: Now we need to perform conditional grouping: group by the first two fields ID and SPLIT. If there are no duplicate DATEs within the group, keep t...Jun 10, 2025·2 min read
Change Duplicate Contents to NULL — From SQL to SPL #36Problem Description & Analysis: The first two columns of a certain database table have duplicate values, such as the 2nd-3rd records and the 1st record being duplicated below. Task: Now we need to change all duplicate values to null. In other words,...Jun 6, 2025·2 min read
Get the Initial Date Using the Total — From SQL to SPL #35Problem Description & Analysis: A certain database table records the planned inbound quantity and total inventory after inbound on specific dates, such as the planned inbound quantity of 0.6 on February 26th, resulting in a total inventory of 3. Tas...Jun 4, 2025·2 min read
Getting the Available Ranges from Two Tables — From SQL to SPL #34Problem Description & Analysis: There are two tables in a certain database. The original inventory table data_add stores multiple batches of inventory for multiple items. Each batch of inventory has a starting number START_NUM and an ending number EN...May 30, 2025·3 min read
Total under Recursive Relationship — From SQL to SPL #33Problem Description & Analysis: A certain database has a ticket table and a work hour table. The ticket table stores the relationship between each ticket and its parent ticket, forming a self-association structure: The work hour table stores multipl...May 28, 2025·2 min read