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

  • SEARCH
  • Home
  • 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

I'm new at PHP and SQL, so I was playing around with this table
I've been playing around with a few SQL queries trying to get the column
Been playing around with this for a couple of hours and can't seem to
i'm playing around with building a sql function that will extract numbers from a
I'm playing around with t-sql and would like to be able to select into
Playing around with SQL Server 2008 and I have a table People with columns:
Just playing around with subqueries in SQL Server (I know that this problem doesn't
After playing around with haskell a bit I stumbled over this function: Prelude Data.Maclaurin>
Just playing around with memcache for the first time; here's my code: $memcache =
I have been playing around with a quite complex SQL Statement for a few

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.