Auto Adjust Age

Поиск
Список
Период
Сортировка
От Carlos Mennens
Тема Auto Adjust Age
Дата
Msg-id BANLkTi=GieGHh59xrcsCRuGw8MQuGQ3Erg@mail.gmail.com
обсуждение исходный текст
Ответы Re: Auto Adjust Age
Re: Auto Adjust Age
Re: Auto Adjust Age
Re: Auto Adjust Age
Список pgsql-general
I've only been using PostgreSQL since Oct 2010 and it's my first
experience with SQL or any ORDBMS. I've searched on the web and been
creating my own database users, databases, tables from scratch which
has been interesting to say the least but now I would like to know if
this is possible in SQL or PostgreSQL since I can't find anything
online that shows me how to do so. I've created a table called 'users'
and I have it configured as follows:

CREATE TABLE users
(
   id integer PRIMARY KEY UNIQUE NOT NULL, --ID
   fname character varying(40) NOT NULL, --First name
   lname character varying(40) NOT NULL, --Last name
   email character varying NOT NULL, --email address
   office integer NOT NULL, --Office number
   dob date NOT NULL, --Date of birth
   age integer NOT NULL --Age
)
;

Is there a way in SQL I can have the users 'age' be auto adjusted
based on the 'id' & 'dob'? I would assume this is possible because if
you have 100 employees, I doubt someone has time to sit and change
everyone's age from 31 > 32 on their birthday. Can someone please help
explain how this works or what the SQL code would look like assuming
that it's possible? I have no advanced far enough to see what triggers
and views are so perhaps it's just my level with SQL in general.

Thank you so much.

В списке pgsql-general по дате отправления:

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: temp tables not dropping at end of script
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: temp tables not dropping at end of script