Skip to content
KNIME Documentation
Main Navigation Get startedBuildWork with KnimeAccount and adminRelease notesDeveloper tools
Community Hub
DevelopersKnime
Sidebar Navigation

Getting Started

Installation

User Guide

Release Notes

Install Extensions

Building Workflows

Components

Flow Control

Expressions

File Handling

Deployment

Integrated Deployment

Workflow Invocation

Best Practices

Advanced Features

AI Extension

Get Started

Build an Agent

Inject context with RAG

LLM Providers

Tutorials

Summarize product reviews

Product FAQ assistant

Restaurant agent

Your first local agent

Task extractor

Reporting

Kerberos

Extensions

Database

Overview

Tutorials

Read and filter data from a database

Write a transformed dataset to a database

Concepts

Ports and Sessions

Query Generation

Type Mapping

Deprecated Framework

Connecting

Connect: Dedicated Node

Connect: File-Based Database

Connect: Generic DB Connector

Register a JDBC Driver

Install Third-Party Driver Plug-in

Drivers on Hub and Server

Kerberos Constrained Delegation

Reading and Transforming

Read Data

Transform Data Visually

Run a Custom SQL Query

Parameterize a Query

Writing and Modifying

Insert, Update, or Merge

Delete Rows

Bulk Load Data

Create and Remove Tables

Use Transactions

Reference

Connector Node Settings

JDBC Driver Reference

Deprecated Node Mapping

Migrate Deprecated Workflows

Python

Overview

Tutorials

Python Scripting Quickstart

Data App Development Using Plotly

Data Processing

K-AI Scripting Assistant

Data Type Conversion

Batch Processing

Jupyter Integration

Environment Management

Pixi Configuration

Dependency Management

Environment Persistence

Channel Mirrors & Air-Gapped Setups

Conda Migration

Alternative Configurations

Conda and Miniforge Setup

Conda Environment Propagation

Manual Python Configuration

Legacy Node Migration

Concepts

Pixi Backend Architecture

Storage Logic

Python Environments on Executors

Reference

Python Scripting API

Bundled Packages

Executor and Hub Configuration

Troubleshooting Guide

API Reference

Inputs and outputs

Classes

Views

Utility functions

R

Deep Learning

Snowflake

Google Cloud

Azure

AWS

Big Data

Big Data Admin

Big Data Secured Cluster

Databricks

Microsoft Fabric

Power BI

Tableau

Report Designer

H2O

Changelogs

Version 5.12

Version 5.11

Version 5.10

Version 5.9

Version 5.8

Version 5.7

Version 5.6

Version 5.5

Version 5.3

Extensions

Write a transformed dataset to a database ​

This tutorial shows how to connect to a database, aggregate and join data entirely in-database, write the result to a new table, and verify the output.

What you need ​

  • KNIME Analytics Platform. All database nodes are included in every installation, so no additional extension is required.
  • A JDBC-compliant database (this tutorial uses MySQL)
  • Database credentials (username and password)

Steps ​

1. Connect to the database ​

Add a MySQL Connector node to your workflow (or use the PostgreSQL Connector or generic DB Connector for other databases). Click the node once to open its configuration, then enter the Hostname, Port, and Database name. Under Authentication, provide your Username and Password. Execute the node to open the connection.

2. Select the source table ​

Connect a DB Table Selector node to the Connector node. Click the node once to open its configuration, then click Browse to view the available schemas and tables and select your source data table.

3. Group rows in the database ​

Connect a DB GroupBy node to the DB Table Selector. In the Groups tab, add the columns you want to group by (for example, Category or Region). In the Manual Aggregation tab, select the numerical columns to aggregate and choose an aggregation method (for example, SUM, AVG, or MAX).

4. Join the grouped result ​

Connect a DB Joiner node. Connect the DB GroupBy output to the bottom input port and the original DB Table Selector output to the top input port. Click the node once to open its configuration. Under Matching Criteria, click + Add matching criterion and select the matching column under Top input ('left' table) and Bottom input ('right' table) (for example, Region on both sides). Under Output Columns, use Manual, Pattern, or Type selection to include or exclude specific columns from the final combined dataset.

5. Write the result to a new table ​

Connect a DB Writer node to the DB Joiner output. Click the node once to open its configuration, then type a name for your output table in the Table name field. Under If table exists in database, choose Fail to stop execution if the name is already taken, or Remove existing table and contained data to overwrite it.

INFO

Executing the DB Writer node sends the compiled SQL script to your database server. The database performs the grouping and joining on its own engine and writes the final table.

6. Verify the output ​

Connect a DB Reader node to the DB Writer output and execute it. The node reads the result back into KNIME Analytics Platform so you can inspect the written table.

An example workflow is available on KNIME Hub.

Pager
Previous pageRead and filter data from a database
Next pagePorts and Sessions