DEV Community

Judy
Judy

Posted on

2 1 1 1 1

Group and Summarize data, and align to the specified sequence #eg31

Below is temp_data table in Oracle database:

Image description
LETTER is the foreign key field, which points to temp_ref table’s LETTER field, whose order is specified by LETTER_SEQ field in the same table.

Image description
Task: Group temp_data table by the year and LETTER field, count records in each group, and align records to the cross product of the year and the LETTER; record CNT as null if no count value exists. Arrange years in the chronological order and the LETTER according to LETTER_SEQ. Below is the expected result:

Image description
Write the following SPL code:

Image description

A1, A2: Run the simple SQL to group and summarize temp_data table; and retrieve values of LETTER field in the specified order.

A3: Compute cross product of the year and the letter, and then associate the result with A1 through the foreign key. #1 is the 1st field.

Source

SPL open source address

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay