98-364 question 51 discussion

answered

You have the database table named Cars as defined below:


You have the following Structured Query Language (SQL) statement:

How many rows are returned by the SQL statement?

  • A. 4
  • B. 5
  • C. 6
  • D. 7
Created 1 year, 1 month ago by saad_hassan102000

saad_hassan102000

D is true , A is wrong

nyumaiku

A is correct. Try it on SQL Server

picasso

The answer is correct, the statements are executed individually, therefore if the first query element is true (c.Origin <> 'USA'), only then will it move onto the second which is again applied separately (c.Color <> 'Black'). On the first query, 2 rows are excluded (The USA rows) and on the second query only 2 remaining Black colors exist which are then excluded also, leaving 4 rows). You should not make statments stating "Try it on SQL Server" without first doing so yourself which would indeed have proved you to be mistaken.

bongonets

The symbol <> means "not equal to" therefore, A is the right answer

Ketaki

Right answer is A..

shortcut

beware "<>" and "not" statement dude...

cloud9twice

A, yes, they did execute it in the first query element first, check on origin first if it's not USA then they would immediately not include the row

meena79anand

7 rows will be returned since the only record getting eliminated is Convertible-Black-USA

vante_1230

A is correct because of the AND operator.. if the operator is OR then it will return 7 rows.

ericd

the key word there is the 'and' in the where clause. both rows should not be USA AND not be black. correct answer is 7

candrei

Run it on my local sql and A is correct. Make a table, insert the data and run the select if you don't believe.

Andyman

The right answer is A! If you want D put OR instead of AND. It was tested on SQL Server. It looks strange but it works.

tiduarte8

Está correcta la respuesta es la A lo acabo de probar

ozy

A is correct ppl

dou11051446

The answer is A and not D as some might expect. The sql statement does not check both fields for a true value. Instead it steps through origin and color fields one at a time. If AND was replaced with OR it would return 7 rows.

Arif708

The correct answer is D. 7 rows. Because Where Origin in not USA and Color is not Black.

bard

To help some: Query written in plain english: Select everything from table 'Cars' where the oirigin IS NOT USA and the color IS NOT black