Hi
I was playing around with SQL Queries and this one came to my mind - select x,y from table T
.
Here x and y can be arithmetic expressions like 2.0/5.0 OR 1+2, the result has the number of rows of table T, with the first column having value 2.0/5.0 i.e. 0.444444 and the second column having value 3.
I am curious to know as to how this query is executed. I have learned that in the SQL query engine there is a mapping from SQL representation of a query to an internal representation (like relational algebra) which is then optimized in order to yield an optimal query execution plan.
Please correct my understanding if its wrong - For the query which I have stated, there would be an internal mapping from my query Q to an internal representation which is equivalent to that of select * from table T
. Then for all the rows returned, n number of columns are projected out where n is the number of arithmetic expressions stated in the Q. And all rows for the n columns would have their respective evaluations of the arithmetic expressions.
cheers