From the course: Apache Flink: Exploratory Data Analytics with SQL
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Adding new columns - SQL Tutorial
From the course: Apache Flink: Exploratory Data Analytics with SQL
Adding new columns
- [Instructor] In this example, we will add a new column to an existing table and populate that column. We continue with the same Advanced Batch Analytics class we used in the previous videos. We want to add a new column called total price by multiplying the rate column with the quantity column. For this, we use the add columns operator. In this operator, we specify the value to be stored as rate multiplied by quantity and assign the name total price to it. Flink automatically picks up the data type based on the sort columns. Once added, we print the schema and the data for this column. To do the same with SQL, we simply use the column as part of a SELECT statement in the same way we used it in the add columns function. It will make its way into the resulting table called enhancedSalesTableSQL. We print the contents of this table also. The enhancedSalesTableSQL object can then be useful for the analysis. If we need…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.