Jump to content

SQL Help?

sinkesnnj

So today on collage i had an sql query test where on of the questions was if the following two are equal:

 

1)  a OR b*c>=d

2)  a OR (b*c>=d)

 

Now i answered yes, but some guys from my class made a point where in the first case it would do it like this (a OR b*c) >= d and the two above were not equal. Was i right or were they right?

Link to comment
Share on other sites

Link to post
Share on other sites

So today on collage i had an sql query test where on of the questions was if the following two are equal:

 

1)  a OR b*c>=d

2)  a OR (b*c>=d)

 

Now i answered yes, but some guys from my class made a point where in the first case it would do it like this (a OR b*c) >= d and the two above were not equal. Was i right or were they right?

Im not sure about SQL but from what I know in Python they should return equally 

I'd suggest you look up the order in which logical operators are evaluated.

 

EG in Python Compairison operators is higher on the order of operation than Boolean Conditionals

Link to comment
Share on other sites

Link to post
Share on other sites

looking at operator precedence of sql, I would say they are equal.

highest

*

>=

OR

lowest

Thank you very much good sir, god bless you!

Link to comment
Share on other sites

Link to post
Share on other sites

So today on collage i had an sql query test where on of the questions was if the following two are equal:

 

1)  a OR b*c>=d

2)  a OR (b*c>=d)

 

Now i answered yes, but some guys from my class made a point where in the first case it would do it like this (a OR b*c) >= d and the two above were not equal. Was i right or were they right?

assuming a, b, c and d are the same values for both they would be the same

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×