What is an "alpha answer"?


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?

Michael Rybkin

Posted 2014-08-14T17:54:35.643

Reputation: 37 124



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:

Esoteric Screen Name

Posted 2014-08-14T17:54:35.643

Reputation: 7 480


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


Posted 2014-08-14T17:54:35.643

Reputation: 605

3I 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 – 2014-08-14T21:00:34.730

2Because 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 – 2014-08-15T04:09:24.157

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 – 2014-08-15T19:08:22.693