Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL select that returns a dummy column?

Tags:

sql

mysql

Is there a way i can do a SELECT and tell it to return 3 columns and a dummy empty column ? I need 4 columns and the 3rd must be '' until the table is somewhere in the database. I am not allowed to add any columns to any tables.

like image 946
An employee Avatar asked Oct 08 '09 16:10

An employee


People also ask

How do I return a column in MySQL?

Use the asterisk character (*) in place of a column list in a SELECT statement to instruct MySQL to return every column from the specified table.

What is select * from in MySQL?

The SELECT statement is used to select data from a database. The data returned is stored in a result table, called the result-set.

How do I select only NULL values in MySQL?

To look for NULL values, you must use the IS NULL test. The following statements show how to find the NULL phone number and the empty phone number: mysql> SELECT * FROM my_table WHERE phone IS NULL; mysql> SELECT * FROM my_table WHERE phone = ''; See Section 3.3.


2 Answers

Select column1, column2, 'waiting for table' as dummy_column, column4
from your_table
like image 100
Sean Vieira Avatar answered Sep 20 '22 12:09

Sean Vieira


mysql> SELECT '' AS empty_col;
+-----------+
| empty_col |
+-----------+
|           |
+-----------+
1 row in set (0.00 sec)
like image 43
Dan Carley Avatar answered Sep 24 '22 12:09

Dan Carley