Yes sure, You can named column with as
keyword. For example:
SELECT 1 as 'hello'
And You can simply add RowNumber column like below example:
SELECT t.*,
@rownum := @rownum + 1 as RowNumber
FROM your_table t,
(SELECT @rownum := 0) r
For start from 149
, You just need to replace (SELECT @rownum := 0)
with (SELECT @rownum := 149)
For a dummy column with the certain type, Use Cast
or Convert
functions like this: CAST(@rownum := @rownum + 1 AS CHAR) AS RowNumber
. You can find more about this here: http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html
More Examples related to the comments:
SELECT
COUNT(col1) AS col2
FROM your_table
GROUP BY col2
HAVING col2 = 2;
@nodsdorf example in the comments:
SELECT
(1+1) AS dummy,
other_column
FROM table