I have a mysql table EMPLOYEE
+-------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(30) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| start_salary | int(11) | YES | | NULL | |
| current_salary | int(11) | YES | | NULL | |
| address | varchar(255) | YES | | NULL | |
| designation | varchar(10) | YES | | NULL | |
+-======------------+--------------+------+-----+---------+-------+
Now, I would want to do a select statement like
SELECT (current_salary/start_salary) appraisal, * from EMPLOYEE;
But the above statement is not valid in mysql. This is not homework but a dummy eg. Is it possible to have an extra column along with all existing columns of a table using * as wildcard operator?
What is the best way to do something like this?
Yes absolutely. Trick is simple, just put the wildcard FIRST.
That’s it!