Creating New Columns and Mathematical Operations in PostgreSQL
Introduction and Context Setting
Welcome to this lesson on creating new columns and performing mathematical operations in PostgreSQL. This lesson builds on what you've learned so far about text-based queries and subqueries. We will dive into ways to derive insightful data by applying mathematical operations and creating new columns.
Dataset Review
For convenience, the tables and columns in our Marvel movies dataset are:
Movies Table
Movie Details Table
Characters Table
Reviewing Column Aliases
The SELECT statement is used to retrieve data from a database. Aliases are used to give columns a temporary name, which makes the output more readable.
We can use an alias to rename the movie_name column "Film Name" as follows:
The output is:
The output selects all movie names, but changes the column name in the output from "movie_name" to "Film Name".
Creating New Columns with String Concatenation
