Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 236999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:23:25+00:00 2026-05-11T20:23:25+00:00

I was playing around with SQL Queries and this one came to my mind

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:23:25+00:00Added an answer on May 11, 2026 at 8:23 pm

    It most likely depends on the database.

    If the expressions you use for x and y were constant then a decent database ought to recognize that and perform the calculation only once and just putting the value in the result set.

    If the expressions included some other function then it would have to execute the expression each time in case the function had side effects.

    In general you are correct, calculate the virtual table described in the from clause, then I believe the filters from the where clause are applied followed by the select clause.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While playing around with regexps in Scala I wrote something like this: scala> val
I've been playing around lately with SQL Data Services. Although (or perhaps because) I
Just playing around with the now released Silverlight 2.0. I'm trying to put a
I'm currently playing around with HTML_QuickForm for generating forms in PHP. It seems kind
I'm playing around with the <canvas> element, drawing lines and such. I've noticed that
I'm playing around with LinqToSQL using an existing multi-lingual database, but I'm running into
I'm playing around with a native (non-web) single-player game I'm writing, and it occured
Hallo i am currently playing around with castle projects ActiveRecord and the remoting facility.
I was playing around with my own Sudoku solver and was looking for some
I am playing around with MVC and have started setting up an existing site

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.