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
Carlos Mennens writes:
> 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, --O
On 04/06/2011 08:53 AM, Carlos Mennens wrote:
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
On 04/06/2011 08:53 AM, Carlos Mennens wrote:
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
On Wed, Apr 06, 2011 at 10:53:49AM -0400, Carlos Mennens wrote:
> 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, --
On Wed, Apr 6, 2011 at 11:15 PM, Jerry Sievers wrote:
> Carlos Mennens writes:
>
>> 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 var
On Wed, Apr 06, 2011 at 11:15:31AM -0400, Jerry Sievers wrote:
> I'd suggest not storing age but instead wrapping with a view that calls
> date_trunc('year', now() - dob).
Or put that in the query:
SELECT
...,
date_trunc('year', now() - dob) as age
FROM
users
;
Karsten
-
On Wed, Apr 6, 2011 at 11:20 AM, Andrew Sullivan wrote:
> Why do you have the age stored at all? When you SELECT from the table
> and want someone's age, just do
>
> SELECT [. . .], extract('years' from age(CURRENT_TIMESTAMP,dob)) as age
> . . . FROM users . . .
>
> By and large, it'
On Wed, Apr 6, 2011 at 11:24 AM, JC de Villa wrote:
> Theres also the age() function
>
> SELECT age(dob);
>
> Should give you
>
> age
> -
> 31 years 5 mons 17 days
>
> If you want to be really exact about it. :)
That worked awesome too!
ide=# SELECT age(dob
On 2011-04-06, Carlos Mennens wrote:
> 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 wo
On 2011-04-06, Jerry Sievers wrote:
> Carlos Mennens writes:
>
>> 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, --e
In response to Jasen Betts :
> On 2011-04-06, Jerry Sievers wrote:
> > Carlos Mennens writes:
> >
> >> 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 na
12 matches
Mail list logo