File size: 1,651 Bytes
40b5d04
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
PRAGMA foreign_keys = ON;

CREATE TABLE `state` (
  `state_name` text
,  `population` integer DEFAULT NULL
,  `area` double DEFAULT NULL
,  `country_name` varchar(3) NOT NULL DEFAULT ''
,  `capital` text
,  `density` double DEFAULT NULL
,  PRIMARY KEY (`state_name`)
);

CREATE TABLE `city` (
  `city_name` text
,  `population` integer DEFAULT NULL
,  `country_name` varchar(3) NOT NULL DEFAULT ''
,  `state_name` text
,  PRIMARY KEY (`city_name`,`state_name`)
,  FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`)
);
CREATE TABLE `border_info` (
  `state_name` text
,  `border` text
,  PRIMARY KEY (`border`,`state_name`)
,  FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`)
,  FOREIGN KEY(`border`) REFERENCES `state`(`state_name`)
);
CREATE TABLE `highlow` (
  `state_name` text
,  `highest_elevation` text
,  `lowest_point` text
,  `highest_point` text
,  `lowest_elevation` text
,  PRIMARY KEY (`state_name`)
,  FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`)
);
CREATE TABLE `lake` (
  `lake_name` text
,  `area` double DEFAULT NULL
,  `country_name` varchar(3) NOT NULL DEFAULT ''
,  `state_name` text
);
CREATE TABLE `mountain` (
  `mountain_name` text
,  `mountain_altitude` integer DEFAULT NULL
,  `country_name` varchar(3) NOT NULL DEFAULT ''
,  `state_name` text
,  PRIMARY KEY (`mountain_name`, `state_name`)
,  FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`)
);
CREATE TABLE `river` (
  `river_name` text
,  `length` integer DEFAULT NULL
,  `country_name` varchar(3) NOT NULL DEFAULT ''
,  `traverse` text
,  PRIMARY KEY (`river_name`)
,  FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`)
);