wrong test?

S

Spartaco

This is a test I made that I believe has a wrong solution, they say the
correct answer is C ?!?

----
You are an asp.net developer and currently you are working on te sql
statement you will use to retrieve data from te customers table. Wat is te
result of the following statement ?

SELECT ID='identity', name='customer'
FROM customers
WHERE ID=1

A) The SQL statement results in te customers table being updated with te
values in te two variables identity and name.

B) The SQL statement results in two columns tat contain te strings
'identity' and 'name' for every row.

C) The SQL statement results in two columns labeled identity and name being
returned.

D) The SQL statement results in a syntax error.
 
S

Steve C. Orr [MVP, MCSD]

Yes, C sounds right to me.
You might as well delete everything after the FROM statement because it's
not being used. No columns from the customers table are being referenced,
rather two hard coded values are being returned.
 
B

bruce barker \(sqlwork.com\)

c is correct.

the column names returned are:

id,name

but the number of rows in the result set will depend on the number of
customer whose id is 1. if none, no rows are returned. if 1 or more then
each row will be the strings:

'identity','customer'


-- bruce (sqlwork.com)
 
J

Juan T. Llibre

The correct answer is "C".

One row will be returned; there will be two columns in it.
 
S

sloan

It also depends if the customers table has an entry in it, with ID of 1.

Use pubs
GO

SELECT ID='identity', name='customer'
FROM titles
WHERE title_id='doesnotexist'

SELECT ID='identity', name='customer'
FROM titles
WHERE title_id='ps3333'

Go
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top