我在sql“empleado”中有一个表,从中可以计算出我想要的属性之一。如何在PosgreSQL中创建计算属性
这是代码:
create table empleado (
dni char(9) not null,
contrasena varchar (20) not null,
nombre varchar (30) not null,
apellidos varchar (60) not null,
direccion varchar (80) not null,
telefono char (9) not null,
tipo varchar(30) not null,
fechaIngreso date not null,
antiguedad Integer as getdate()-fechaIngreso,
salario real not null check (salario >0),
primary key (dni)
);
属性安蒂格达德必须是实际的日期 - “fechaIngreso” 以天为单位。我怎么能解决这个问题?
谢谢
您使用的是MySQL还是SQL Server? MySQL不支持'getdate()',计算列或检查约束。请适当地标记你的问题。 –
我使用的是ProsgreSQL,我认为它是mysql – vps
。 。 Postgres不同于MySQL和SQL Server。 –