I have this table:
Person Name Birthday City
Mary December New York
John March Seatle
Peter November Los Angeles
Assuming all people are male...
how can i add a new column Gender with value M, like the example below? Is it possible?
Person Name Birthday City Gender
Mary December New York M
John March Seatle M
Peter November Los Angeles M
Yes:
alter table t add gender varchar2(1) default 'M'
EDIT:
If you just want to return a column in a SELECT
, you can do:
select t.*, 'M' as gender
from t;
However, you cannot modify the table from a SELECT
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.