August 17, 2011 at 4:21 pm
Below is a question I got on an exam but not sure what the correct answer would be?
Which of the following values will be returned by the SQL statement below?
SELECT price, quantity FROM orders WHERE quantify BETWEEN 50 and 75;
A. 2.55, 55
B. 3.5, 72
C. 4.25, 75
D. A & B
E. All of the above
A clever person solves a problem. A wise person avoids it. ~ Einstein
select cast (0x5365616E204465596F756E67 as varchar(128))
August 17, 2011 at 5:26 pm
That depends, if
SELECT price, quantity FROM orders WHERE quantify BETWEEN 50 and 75;
Is accurate, then none of the above is correct.
But if you mean this:
SELECT price, quantity FROM orders WHERE quantity BETWEEN 50 and 75;
Then A, B and C are valid answers.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
August 17, 2011 at 5:48 pm
I created my own test table and loaded it with the values they have as options. As shown below…
create table exam (price money null, quantity decimal(5,2) null)
I then input the values from the question into the table and here is results.
price quantity
--------------------- ---------------------------------------
20.00 2.55
20.00 55.00
20.00 3.50
20.00 72.00
20.00 4.25
20.00 75.00
(6 row(s) affected)
Now I ran the query in the question…
select price, quantity from exam
where quantity between 50 and 75
And here are the results…
price quantity
--------------------- ---------------------------------------
20.00 55.00
20.00 72.00
20.00 75.00
(3 row(s) affected)
As can be seen none of the values under 10 with an associated decimal value are returned. That is because they are not between the numbers 50 and 75. Which is expected. What isn’t expected is that there is no answer between A-E to answer correctly these results (i.e. A can’t be a correct answer because both the 2.55 and 55 values are not returned, same with B and C.).
A clever person solves a problem. A wise person avoids it. ~ Einstein
select cast (0x5365616E204465596F756E67 as varchar(128))
August 17, 2011 at 5:58 pm
Are the values you input into the table what was presented on the exam?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
August 17, 2011 at 6:23 pm
Same values Chump
A clever person solves a problem. A wise person avoids it. ~ Einstein
select cast (0x5365616E204465596F756E67 as varchar(128))
August 17, 2011 at 6:25 pm
Anyone with a grip on reality please answer?
A clever person solves a problem. A wise person avoids it. ~ Einstein
select cast (0x5365616E204465596F756E67 as varchar(128))
August 17, 2011 at 8:56 pm
DatabaseHell (8/17/2011)
Same values Chump
Seriously?
You come to a forum where people volunteer their time to ask for assistance with YOUR exam?
The answer is obvious - talk to your prof about it. There is a typo in the exam.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
August 17, 2011 at 8:57 pm
DatabaseHell (8/17/2011)
Anyone with a grip on reality please answer?
Again - why the need to attack?
Think through the problem with a bit of logic.
If you didn't have a typo in the values that you posted in this forum, then OBVIOUSLY there is a typo on your exam.
Talk to your prof!!!!!!!!!!!!!!
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
August 17, 2011 at 9:56 pm
DatabaseHell (8/17/2011)
Same values Chump
Heh... not sure where you come from but the word "Chump" isn't a complimentary one. You won't get any reasonable answers when you use such words. Good luck with the reality of your test. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
August 17, 2011 at 10:37 pm
DatabaseHell (8/17/2011)
Same values Chump
DatabaseHell (8/17/2011)
Anyone with a grip on reality please answer?
First of all, this is a professional site and comments like this are not acceptable. I hope this isn't how you deal with your professors or others like this in person.
Second, it looks like you entered your values wrong.
A. 2.55, 55
B. 3.5, 72
C. 4.25, 75
D. A & B
E. All of the above
Price Quantity
2.55 55
3.5 72
4.25 75
Now, what do you think the answer is to the question?
August 17, 2011 at 11:56 pm
If you didn't pass the test, sue the professor ! :hehe:
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
August 18, 2011 at 7:08 am
TBM, you're misreading the question. Price isn't part of the Where clause. E is correct. Unless the typo in the query is in the original quesition, in which case the result is an error message, not a dataset. The first number in each answer is the Price column, as per the query, and has nothing to do with the Where clause or which rows are returned.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply