BEGIN;

--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;


--
-- Name: customer; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE customer (
    id integer NOT NULL,
    name text NOT NULL,
    email text NOT NULL,
    phone text,
    address text
);


--
-- Name: customer2; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE customer2 (
    id integer NOT NULL,
    name text,
    email text,
    phone text,
    address text
);


--
-- Name: customer_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE customer_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: customer_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE customer_id_seq OWNED BY customer.id;


--
-- Name: customer_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('customer_id_seq', 10, true);


--
-- Name: employee; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE employee (
    id integer NOT NULL,
    name text,
    boss integer
);


--
-- Name: item; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE item (
    id integer NOT NULL,
    name text NOT NULL,
    price integer,
    description text,
    CONSTRAINT item_price_check CHECK ((price > 0))
);


--
-- Name: item_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE item_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: item_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE item_id_seq OWNED BY item.id;


--
-- Name: item_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('item_id_seq', 15, true);


--
-- Name: j1; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE j1 (
    id integer NOT NULL,
    j1_val text
);


--
-- Name: j2; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE j2 (
    id integer NOT NULL,
    j2_val text
);


--
-- Name: sales; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE sales (
    id integer NOT NULL,
    customer_id integer,
    item_id integer,
    number integer NOT NULL,
    "time" timestamp(0) without time zone DEFAULT now(),
    CONSTRAINT sales_number_check CHECK ((number > 0))
);


--
-- Name: sales_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE sales_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: sales_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE sales_id_seq OWNED BY sales.id;


--
-- Name: sales_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('sales_id_seq', 100, true);


--
-- Name: t_score; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE t_score (
    id integer,
    point integer
);


--
-- Name: t_survey; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE t_survey (
    id integer,
    comment text
);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE customer ALTER COLUMN id SET DEFAULT nextval('customer_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE item ALTER COLUMN id SET DEFAULT nextval('item_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE sales ALTER COLUMN id SET DEFAULT nextval('sales_id_seq'::regclass);


--
-- Data for Name: customer; Type: TABLE DATA; Schema: public; Owner: -
--

COPY customer (id, name, email, phone, address) FROM stdin;
1	守屋一郎	moriya@foo.bar	03-1111-2222	東京都
2	山形二郎	yamaga@foo.bar	03-2222-3333	東京都
3	宮崎三郎	miyaz@foo.bar	048-333-4444	埼玉県
4	寺本四郎	tm@baz.bar	048-444-5555	埼玉県
5	前川五郎	maek@baz.bar	03-5555-6666	東京都
6	渡辺六朗	wat@baz.bar	03-6666-7777	東京都
7	神田七朗	kan@hoge.bar	03-7777-8888	東京都
8	細川八朗	hoso@hoge.bar	03-8888-9999	東京都
9	村上九朗	mura@foo.bar	043-111-2222	千葉県
10	紺野十兵衛	kon@foo.bar	043-222-3333	千葉県
\.


--
-- Data for Name: customer2; Type: TABLE DATA; Schema: public; Owner: -
--

COPY customer2 (id, name, email, phone, address) FROM stdin;
1	守屋一郎	moriya@foo.bar	03-1111-2222	東京都
20	佐々木二葉	futaba@foo.bar	03-0992-2345	東京都
30	湯元三恵	mie@foo.bar	048-999-8888	埼玉県
\.


--
-- Data for Name: employee; Type: TABLE DATA; Schema: public; Owner: -
--

COPY employee (id, name, boss) FROM stdin;
101	田中一郎	\N
102	佐藤二郎	101
103	山本三郎	101
104	鈴木四郎	102
105	山田五郎	102
\.


--
-- Data for Name: item; Type: TABLE DATA; Schema: public; Owner: -
--

COPY item (id, name, price, description) FROM stdin;
1	改定第3版　PostgreSQL完全攻略ガイド	4980	技術評論社　石井達夫 著
2	実践PostgreSQL	4800	オライリー・ジャパン　ジョン・ウォースレイ 著
3	PostgreSQLオフィシャルマニュアル	4980	インプレス　PostgreSQL Global Development Group 著
4	エキスパートから学ぶPostgreSQL活用テクニック	3980	インプレス　リチャード・ストーンズ／ニール・マシュー 共著
5	はじめてのPostgreSQL	4200	ピアソンエデュケーション　ブルース・モムジャン 著
6	PostgreSQL: Introduction and Concepts	5758	ピアソンエデュケーション　BRUCE MOMIJIAN 著
7	PHP x PostgreSQLで作る最強Webシステム	2880	技術評論社　石井達夫 著
8	SQLクイックリファレンス	2800	オライリー・ジャパン　ケビン・クライン／ダニエル・クライン 共著
9	SQLポケットリファレンス	1980	技術評論社　朝井 淳 著
10	Postgresql Essential Reference	4798	Macmillan Computer Pub　Barry Stinson 著
11	Database-SQL-Rdbms Howto	2634	Iuniverse.Com　Alavoor Vasudevan 著
12	トランザクション処理〈上〉	6800	ソフトバンクパブリッシング　ジム グレイ／アンドレアス ロイター 共著
13	トランザクション処理〈下〉	6800	ソフトバンクパブリッシング　ジム グレイ／アンドレアス ロイター 共著
14	PHP4徹底攻略　改訂版	3800	ソフトバンクパブリッシング　堀田倫英／石井達夫／広川類 共著
15	PHP4徹底攻略　実戦編	3800	ソフトバンクパブリッシング　広川類／桑村潤／小山哲志 共著
\.


--
-- Data for Name: j1; Type: TABLE DATA; Schema: public; Owner: -
--

COPY j1 (id, j1_val) FROM stdin;
1	一
1	壱
2	二
3	三
5	五
\.


--
-- Data for Name: j2; Type: TABLE DATA; Schema: public; Owner: -
--

COPY j2 (id, j2_val) FROM stdin;
0	zero
1	one
2	two
3	three
4	four
\.


--
-- Data for Name: sales; Type: TABLE DATA; Schema: public; Owner: -
--

COPY sales (id, customer_id, item_id, number, "time") FROM stdin;
1	1	3	1	2008-01-07 04:05:06
2	3	9	1	2008-01-08 09:30:25
3	9	2	1	2008-01-08 09:31:40
4	4	6	10	2008-01-08 12:22:30
5	8	4	1	2008-01-09 10:25:30
6	10	10	1	2008-01-09 10:26:22
7	3	12	2	2008-01-10 08:28:21
8	4	1	20	2008-01-14 08:29:34
9	6	3	1	2008-01-19 11:28:10
10	6	8	1	2008-01-19 12:19:21
11	3	2	10	2008-01-23 16:22:05
12	3	9	1	2008-01-23 17:33:12
13	2	12	1	2008-01-25 18:12:02
14	5	10	1	2008-01-31 13:22:09
15	3	1	1	2008-02-01 07:23:11
16	7	6	2	2008-02-01 10:24:56
17	8	3	1	2008-02-01 11:13:33
18	2	9	1	2008-02-02 09:56:22
19	4	12	1	2008-02-02 14:15:46
20	1	15	8	2008-02-03 13:22:43
21	6	3	1	2008-02-05 04:05:06
22	5	9	1	2008-02-06 09:30:25
23	9	14	1	2008-02-08 09:31:40
24	2	7	10	2008-02-08 12:22:30
25	1	4	1	2008-02-09 10:25:30
26	8	13	1	2008-02-09 10:26:22
27	3	15	2	2008-02-10 08:28:21
28	4	9	20	2008-02-10 08:29:34
29	5	3	1	2008-02-12 11:28:10
30	6	8	1	2008-02-22 20:19:21
31	10	2	10	2008-02-23 16:22:05
32	3	5	1	2008-03-01 20:33:12
33	2	7	1	2008-03-01 15:12:02
34	5	11	1	2008-03-02 13:22:09
35	1	7	1	2008-03-02 14:23:11
36	6	15	2	2008-03-03 14:24:56
37	10	4	1	2008-03-04 07:13:33
38	4	2	1	2008-03-06 16:56:22
39	2	12	1	2008-03-07 14:15:46
40	1	15	5	2008-03-09 13:22:43
41	8	3	1	2008-03-10 04:05:06
42	6	9	1	2008-03-10 09:30:30
43	3	2	1	2008-03-11 21:31:40
44	4	6	10	2008-03-13 12:22:30
45	7	4	1	2008-03-15 10:23:30
46	8	5	1	2008-03-17 23:26:22
47	3	10	2	2008-03-18 08:28:21
48	4	1	20	2008-03-18 22:49:34
49	1	13	1	2008-03-19 11:28:10
50	5	8	1	2008-03-19 21:11:21
51	3	2	10	2008-03-20 16:22:27
52	8	9	1	2008-03-23 20:33:12
53	2	14	1	2008-03-24 18:12:02
54	5	10	1	2008-03-27 13:22:09
55	3	8	1	2008-03-28 14:23:11
56	1	9	2	2008-04-01 05:24:56
57	10	8	1	2008-04-01 15:13:33
58	4	3	1	2008-04-01 16:56:22
59	6	14	1	2008-04-02 14:15:46
60	2	10	1	2008-04-03 13:22:43
61	1	13	3	2008-04-08 04:05:06
62	3	4	1	2008-04-08 09:30:25
63	9	2	1	2008-04-08 09:31:40
64	7	6	10	2008-04-08 12:22:30
65	6	7	1	2008-04-09 01:25:30
66	8	11	1	2008-04-09 03:26:22
67	3	5	2	2008-04-10 08:24:21
68	4	1	20	2008-04-10 08:59:59
69	10	3	1	2008-04-19 13:28:10
70	2	4	2	2008-04-19 16:19:21
71	3	2	10	2008-04-23 17:11:05
72	4	9	1	2008-04-23 20:33:12
73	6	8	1	2008-04-25 15:27:02
74	5	10	1	2008-04-26 13:22:09
75	1	6	1	2008-04-26 18:23:11
76	3	15	2	2008-04-28 14:55:56
77	10	4	1	2008-05-01 15:13:33
78	4	8	1	2008-05-01 02:56:22
79	3	7	1	2008-05-02 06:15:46
80	6	11	1	2008-05-03 10:22:43
81	1	13	1	2008-05-08 20:05:06
82	3	1	1	2008-05-08 20:30:25
83	5	3	1	2008-05-08 23:31:40
84	4	7	10	2008-05-09 06:22:30
85	8	4	1	2008-05-09 09:19:30
86	10	9	1	2008-05-09 10:22:22
87	3	10	2	2008-05-10 13:28:21
88	4	3	20	2008-05-10 18:21:34
89	7	1	1	2008-05-11 17:15:10
90	6	8	1	2008-05-14 20:19:21
91	8	2	10	2008-05-14 16:22:05
92	3	9	1	2008-05-15 11:33:12
93	2	4	1	2008-05-15 12:12:02
94	5	10	1	2008-05-16 05:22:09
95	3	6	1	2008-05-17 23:23:11
96	5	8	2	2008-05-18 01:24:56
97	10	1	1	2008-05-20 15:13:33
98	9	14	1	2008-05-21 02:34:22
99	4	10	5	2008-05-21 14:15:46
100	1	5	1	2008-05-23 13:22:43
\.


--
-- Data for Name: t_score; Type: TABLE DATA; Schema: public; Owner: -
--

COPY t_score (id, point) FROM stdin;
1	90
2	50
3	55
4	77
5	85
6	999
7	12
8	32
9	42
10	60
\.


--
-- Data for Name: t_survey; Type: TABLE DATA; Schema: public; Owner: -
--

COPY t_survey (id, comment) FROM stdin;
1	uuum, This is good.
2	So-so
3	\N
4	good
5	worse !
\.


--
-- Name: customer2_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY customer2
    ADD CONSTRAINT customer2_pkey PRIMARY KEY (id);


--
-- Name: customer_email_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY customer
    ADD CONSTRAINT customer_email_key UNIQUE (email);


--
-- Name: customer_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY customer
    ADD CONSTRAINT customer_pkey PRIMARY KEY (id);


--
-- Name: employee_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY employee
    ADD CONSTRAINT employee_pkey PRIMARY KEY (id);


--
-- Name: item_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY item
    ADD CONSTRAINT item_pkey PRIMARY KEY (id);


--
-- Name: sales_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY sales
    ADD CONSTRAINT sales_pkey PRIMARY KEY (id);


--
-- Name: customer_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY sales
    ADD CONSTRAINT customer_id_fk FOREIGN KEY (customer_id) REFERENCES customer(id);


--
-- Name: item_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY sales
    ADD CONSTRAINT item_id_fk FOREIGN KEY (item_id) REFERENCES item(id);


--
-- PostgreSQL database dump complete
--

COMMIT;
