-
Notifications
You must be signed in to change notification settings - Fork 0
/
periodic_table.sql
238 lines (165 loc) · 6.26 KB
/
periodic_table.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.17 (Ubuntu 12.17-1.pgdg22.04+1)
-- Dumped by pg_dump version 12.17 (Ubuntu 12.17-1.pgdg22.04+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP DATABASE periodic_table;
--
-- Name: periodic_table; Type: DATABASE; Schema: -; Owner: postgres
--
CREATE DATABASE periodic_table WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8';
ALTER DATABASE periodic_table OWNER TO postgres;
\connect periodic_table
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: elements; Type: TABLE; Schema: public; Owner: freecodecamp
--
CREATE TABLE public.elements (
atomic_number integer NOT NULL,
symbol character varying(2) NOT NULL,
name character varying(40) NOT NULL
);
ALTER TABLE public.elements OWNER TO freecodecamp;
--
-- Name: properties; Type: TABLE; Schema: public; Owner: freecodecamp
--
CREATE TABLE public.properties (
atomic_number integer NOT NULL,
atomic_mass numeric NOT NULL,
melting_point_celsius numeric NOT NULL,
boiling_point_celsius numeric NOT NULL,
type_id integer NOT NULL
);
ALTER TABLE public.properties OWNER TO freecodecamp;
--
-- Name: types; Type: TABLE; Schema: public; Owner: freecodecamp
--
CREATE TABLE public.types (
type_id integer NOT NULL,
type character varying(255) NOT NULL
);
ALTER TABLE public.types OWNER TO freecodecamp;
--
-- Name: types_type_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
--
CREATE SEQUENCE public.types_type_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.types_type_id_seq OWNER TO freecodecamp;
--
-- Name: types_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
--
ALTER SEQUENCE public.types_type_id_seq OWNED BY public.types.type_id;
--
-- Name: types type_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.types ALTER COLUMN type_id SET DEFAULT nextval('public.types_type_id_seq'::regclass);
--
-- Data for Name: elements; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--
INSERT INTO public.elements VALUES (1, 'H', 'Hydrogen');
INSERT INTO public.elements VALUES (4, 'Be', 'Beryllium');
INSERT INTO public.elements VALUES (5, 'B', 'Boron');
INSERT INTO public.elements VALUES (6, 'C', 'Carbon');
INSERT INTO public.elements VALUES (7, 'N', 'Nitrogen');
INSERT INTO public.elements VALUES (8, 'O', 'Oxygen');
INSERT INTO public.elements VALUES (2, 'He', 'Helium');
INSERT INTO public.elements VALUES (3, 'Li', 'Lithium');
INSERT INTO public.elements VALUES (9, 'F', 'Fluorine');
INSERT INTO public.elements VALUES (10, 'Ne', 'Neon');
--
-- Data for Name: properties; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--
INSERT INTO public.properties VALUES (5, 10.81, 2075, 4000, 3);
INSERT INTO public.properties VALUES (1, 1.008, -259.1, -252.9, 2);
INSERT INTO public.properties VALUES (2, 4.0026, -272.2, -269, 2);
INSERT INTO public.properties VALUES (3, 6.94, 180.54, 1342, 1);
INSERT INTO public.properties VALUES (4, 9.0122, 1287, 2470, 1);
INSERT INTO public.properties VALUES (6, 12.011, 3550, 4027, 2);
INSERT INTO public.properties VALUES (7, 14.007, -210.1, -195.8, 2);
INSERT INTO public.properties VALUES (8, 15.999, -218, -183, 2);
INSERT INTO public.properties VALUES (10, 20.18, -248.6, -246.1, 2);
INSERT INTO public.properties VALUES (9, 18.998, -220, -188.1, 2);
--
-- Data for Name: types; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--
INSERT INTO public.types VALUES (1, 'metal');
INSERT INTO public.types VALUES (2, 'nonmetal');
INSERT INTO public.types VALUES (3, 'metalloid');
--
-- Name: types_type_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
--
SELECT pg_catalog.setval('public.types_type_id_seq', 3, true);
--
-- Name: elements elements_atomic_number_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.elements
ADD CONSTRAINT elements_atomic_number_key UNIQUE (atomic_number);
--
-- Name: elements elements_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.elements
ADD CONSTRAINT elements_pkey PRIMARY KEY (atomic_number);
--
-- Name: properties properties_atomic_number_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.properties
ADD CONSTRAINT properties_atomic_number_key UNIQUE (atomic_number);
--
-- Name: properties properties_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.properties
ADD CONSTRAINT properties_pkey PRIMARY KEY (atomic_number);
--
-- Name: types types_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.types
ADD CONSTRAINT types_pkey PRIMARY KEY (type_id);
--
-- Name: elements unique_name; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.elements
ADD CONSTRAINT unique_name UNIQUE (name);
--
-- Name: elements unique_symbol; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.elements
ADD CONSTRAINT unique_symbol UNIQUE (symbol);
--
-- Name: properties fk_properties_elements; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.properties
ADD CONSTRAINT fk_properties_elements FOREIGN KEY (atomic_number) REFERENCES public.elements(atomic_number);
--
-- Name: properties fk_properties_types; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.properties
ADD CONSTRAINT fk_properties_types FOREIGN KEY (type_id) REFERENCES public.types(type_id);
--
-- PostgreSQL database dump complete
--