Expressions in SELECT
SELECT can calculate values, not just read columns. Use + - * / and give the result an alias.
Example
SELECT title, price, price * 1.075 AS with_tax
FROM courses;Result
title | price | with_tax Intro to HTML | 0 | 0.0 CSS Basics | 5000 | 5375.0 JavaScript | 15000 | 16125.0 Python | 12000 | 12900.0 SQL | 8000 | 8600.0
Exercise
Name a calculated column.
SELECT price * 2 double FROM courses;
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.