5

It may seem a bit odd to return a number for the day of the week, so there’s a function to return the day as its name. The DAYNAME function works like DAYOFWEEK or WEEKDAY but returns a string with the name instead, as shown in Example 8-12.

As you can see, an alpha answer returns:

+-----------------------+
| DAYNAME('1964-10-12') |
+-----------------------+
| Monday                |
+-----------------------+
1 row in set (0.00 sec)

Source: Learning PHP & MySQL: Step-by-Step Guide to Creating Database-Driven Web Sites, by Michele E. Davis, Jon A. Phillips

What does an alpha answer mean?

1

In this case, alpha is an abbreviation for alphabetic. The passage is telling us that the DAYNAME function returns an value (answer) consisting only of letters (alpha), rather than a numerical indicator, which is what DAYOFWEEK and WEEKDAY return.

The use of the term alpha answer is not standard English at all. Even in the realm of programming jargon, it's not correct. Though we can determine the meaning from the context, alpha by itself is ambiguous as an abbreviation. It can mean either alphabetic or alphanumeric, both of which are frequently used when talking about strings. Also, answer is the wrong word (even colloquially) for referring to the result yielded by a function. The correct term is return value (often shortened to just value).

In addition to misusing the terms, the sentence containing an alpha answer is semantically wrong. The answer is what's returned, but it's being used as the subject of the sentence when it should be an object. As written, the sentence means the answer is what's doing the returning. This is wrong because the return value is just a value; it doesn't do anything. It's the function that returns something.

Here's how it should be written:

As you can see, the function returns an alphabetic value:

1

"Alpha" is an abbreviation for alphabetic. That sentence could have been written, "As you can see, a string returns."

  • 3
    I think it's worth making the point that OP's example is not in the least "idiomatic". Personally, I'd go so far as to say it's ignorant/incorrect, but that's just me. – FumbleFingers Reinstate Monica Aug 14 '14 at 21:00
  • 2
    Because this is a question about technical programming jargon, I feel compelled to point out that it's wrong to claim that alpha means the same as string. A string may contain any characters, not just alphabetic letters. Indeed, in the example, '1964-10-12' is a string but definitely not alpha. – Esoteric Screen Name Aug 15 '14 at 4:09
  • Since we're going to be pedantic, a string's a superset of alpha characters. The returned valued is a string. There's no claim that they are equivalent. Pointing out how it could also have been written was an attempt to show this is pretty poor documentation without writing a page on the topic - and linking it back to programming terminology. Hell, since we're talking MySQL, varchar is likely even better. – Todd Aug 15 '14 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.