Search Postgresql Archives

Re: Inserting data in composite types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2006-11-13 at 09:37 -0300, Rodrigo Sakai wrote:
>   Hi, I have a question about how to insert data in composite types!
> 
>  
> 
>   Imagine the exemple:
> 
>  
> 
> CREATE TYPE t_time AS (
> 
>   a date,
> 
>   b date
> 
> );
> 
>  
> 
> CREATE TABLE salary (
> 
>    salary numeric(10,2),
> 
>    t_date t_time
> 
> );
> 
>  
> 
> I know that if I want to insert data in the table SALARY I just have
> to do like:
> 
>  
> 
>   INSERT INTO salary VALUES (1000.00, ‘(2006/10/10, 2006/12/10)’);
> 
>  
> 
> But if I have another table:
> 
>  
> 
> CREATE TABLE employee (
> 
>   employee_id int,
> 
>   name varchar(30),
> 
>   emp_salary salary
> 
> )
> 
>  
> 
> How can I insert a single row in this table???
> 
>  

insert into employee values(1,'name',(1000,
('2006/10/10','2006/10/10')));

Regards,
	Jeff Davis




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux