- This topic is empty.
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Empowering Insights, Unleashing Possibilities
Data Science/Business Analytics for Small Business Applications › Forums › SQL › Creating temporary columns with SELECT
Tagged: temporary columns with SELECT
Here is the problem:
Write and run a query, with no starter code or hints to answer this question: What is the Biweekly High Rate minus the Biweekly Low Rate for job Code 0170?
So, I need to form a temporary column that will hold value of Biweekly High Rate – Biweekly Low Rate for job Code 0170.
With SELECT, how to mention such temporary columns?
Reply
http://www.geeksengine.com/database/basic-select/arithmetic-operations.php
Using a column alias
SELECT my_height_in_inch*2.54 AS my_height_in_cm, my_height_in_inch - your_height_in_inches AS height_difference, 'cat' AS foo, /* in case need to have a static string somewhere for some reason */ NULL AS emp_column /* to have a column of empty data because maybe I am importing this into Excel */