我有一个建筑信息表,其中只包含数字中的建筑类型(例如:建筑类型= 84)。我想在表中添加另一列,其中包含每个建筑物编号类型的说明。沿着建筑类型= 84的位置然后将描述类型设置为住宅。
感谢。
答案 0 :(得分:0)
我会创建一个查找表,如下所示:
create table building_types (
building_type smallint primary key,
description text not null unique
);
填写所需数据:
insert into building_types values
(84, 'Residential');
对你的真实桌子进行左外连接:
select
*
from building_information_table as a
left outer join building_types as b on a.building_type = b.building_type