On Wed, Feb 8, 2012 at 4:06 PM, Philip Couling <phil@pedal.me.uk> wrote:
> You should keep the data types the same. SERIAL is in fact INTEGER so dept
> should be INTEGER.
OK I have my 'employees.dept' field type set to INTEGER but I'm still
trying to understand how I can perform a SQL statement that will allow
me to query the 'employees' table and visibly see employees.manager =
'Phill Collins' rather than it's assigned numerical INTEGER. Below are
both tables described:
Table "public.managers"
Column | Type | Modifiers
--------+-----------------------+-------------------------------------------------------
id | integer | not null default
nextval('managers_id_seq'::regclass)
name | character varying(50) | not null
email | character varying(50) | not null
dept | integer |
salary | numeric(8,2) | not null
hire | date | not null
Indexes:
"managers_pkey" PRIMARY KEY, btree (id)
"managers_email_key" UNIQUE CONSTRAINT, btree (email)
Table "public.employees"
Column | Type | Modifiers
---------+-----------------------+--------------------------------------------------------
id | integer | not null default
nextval('employees_id_seq'::regclass)
fname | character varying(50) | not null
lname | character varying(50) | not null
email | character varying(50) | not null
dept | integer |
manager | integer |
salary | numeric(8,2) | not null
hire | date | not null
Indexes:
"employees_pkey" PRIMARY KEY, btree (id)
"employees_email_key" UNIQUE CONSTRAINT, btree (email)
Is there a way I can query the employees table and have the SQL
statement resolve the INTEGER value from 'employees.manager' to
display the data in 'managers.name'?