SQLite数据库不会从PHP初始化初始化



下面是正在讨论的SQL

--plants table--
CREATE TABLE plants (
  plant_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
  plant_name TEXT NOT NULL,
  genus TEXT NOT NULL,
);

INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (1, 'Pink Muhly Grass', 'Muhlenbergia capillaris');
INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (2, 'Feather reed grass', 'Calamagrostis x acutiflora');
INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (3, 'Smooth Shadbush', 'Amelanchier laevis');
INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (4, 'Chestnut Oak', 'Quercus montana');
INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (5, 'Sideoats Grama', 'Bouteloua curipendula');
INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (6, 'Feverfew', 'Tanasetum parthenium');
INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (7, 'Prairie Cord Grass', 'Spartina pectinata');
INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (8, 'Christmas Fern', 'Polystichum acrostichoides');
INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (9, 'Climbing Hydrangea', 'Hydrangea anomala');
INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (10, 'New England Aster', 'Aster novae angliae');
INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (11, 'Nannyberry', 'Viburnum lentago');
INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (12, 'Hyssop', 'Hyssopus officinalis');
CREATE TABLE plant-tags (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
  plant_id INTEGER NOT NULL,
  tag_id INTEGER NOT NULL,
    FOREIGN KEY (plant_id) REFERENCES plants(plant_id)
  FOREIGN KEY (tag_id) REFERENCES tags(tag_id)
);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
   VALUES (1,1,4);
 INSERT INTO
    plant-tags(id, plant_id, tag_id)
   VALUES (2,1,5);
   INSERT INTO
    plant-tags(id, plant_id, tag_id)
   VALUES (3,1,6);
   INSERT INTO
    plant-tags(id, plant_id, tag_id)
   VALUES (4,1,7);
 INSERT INTO
    plant-tags(id, plant_id, tag_id)
   VALUES (5,1,8);
   INSERT INTO
    plant-tags(id, plant_id, tag_id)
   VALUES (6,1,12);
   INSERT INTO
    plant-tags(id, plant_id, tag_id)
   VALUES (7,1,13);
 INSERT INTO
    plant-tags(id, plant_id, tag_id)
   VALUES (8,1,14);
   INSERT INTO
    plant-tags(id, plant_id, tag_id)
   VALUES (9,1,18);

INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (10, 2, 4);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (11, 2, 5);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (12, 2, 6);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (13, 2, 7);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (14, 2, 8);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (15, 2, 9);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (16, 2, 10);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (17, 2, 11);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (18, 2, 12);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (19, 2, 13);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (20, 2, 14);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (21, 2, 18);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (22, 2, 3);

INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (23, 3, 1);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (24, 3, 2);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (25, 3, 4);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (26, 3, 5);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (27, 3, 7);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (28, 3, 8);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (29, 3, 9);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (30, 3, 12);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (31, 3, 13);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (32, 3, 14);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (33, 3, 15);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (34, 3, 17);


INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (35, 4, 1);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (36, 4, 3);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (37, 4, 5);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (38, 4, 6);

INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (39, 4, 7);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (40, 4, 8);

INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (41, 4, 12);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (42, 4, 13);

INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (43, 4, 14);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (44, 4, 20);


INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (45, 5, 3);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (46, 5, 4);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (47, 5, 5);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (48, 5, 6);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (49, 5, 7);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (50, 5, 8);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (51, 5, 9);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (52, 5, 10);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (53, 5, 12);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (54, 5, 13);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (55, 5, 14);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (56, 5, 18);

INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (57, 6, 1);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (58, 6, 2);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (59, 6, 5);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (60, 6, 6);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (61, 6, 7);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (62, 6, 8);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (63, 6, 9);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (64, 6, 12);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (65, 6, 13);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (66, 6, 14);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (67, 6, 22);


INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (68, 7, 3);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES (69, 7, 4);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(70, 7, 6);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(71, 7, 7);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(72, 7, 8);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(73, 7, 10);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(74, 7, 12);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(75, 7, 14);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(76, 7, 15);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(77, 7, 18);

INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(78, 8, 4);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(79, 8, 5);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(80, 8, 7);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(81, 8, 9);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(82, 8, 12);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(83, 8, 13);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(84, 8, 15);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(85, 8, 16);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(86, 8, 23);

INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(87, 9, 2);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(88, 9, 5);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(89, 9, 7);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(90, 9, 8);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(91, 9, 10);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(92, 9, 12);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(93, 9, 13);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(94, 9, 15);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(95, 9, 16);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(96, 9, 19);

INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(97, 10, 1);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(98, 10, 4);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(99, 10, 6);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(100, 10, 9);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(101, 10, 12);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(102, 10, 13);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(103, 10, 14);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(104, 10, 15);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(105, 10, 21);

INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(106, 11, 1);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(107, 11, 2);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(108, 11, 5);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(109, 11, 7);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(110, 11, 8);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(111, 11, 12);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(112, 11, 13);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(113, 11, 14);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(114, 11, 15);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(115, 11, 17);

INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(116, 12, 21);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(117, 12, 1);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(118, 12, 2);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(119, 12, 4);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(120, 12, 7);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(121, 12, 8);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(122, 12, 9);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(123, 12, 12);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(124, 12, 14);
INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES(125, 12, 16);
CREATE TABLE tags (
  tag_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
  tag_name TEXT NOT NULL,
);
INSERT INTO
tags(id, tag_name)
VALUES (1, "edible");
INSERT INTO
tags(id, tag_name)
VALUES (2, "scent");
INSERT INTO
tags(id, tag_name)
VALUES (3, "sound");
INSERT INTO
tags(id, tag_name)
VALUES (4, "tactile");
INSERT INTO
tags(id,tag_name)
VALUES (5, "visual");
INSERT INTO
tags(id,tag_name)
VALUES (6, "exploratory constructive");
INSERT INTO
tags(id, tag_name)
VALUES (7, "exploratory sensory");
INSERT INTO
tags(id, tag_name)
VALUES (8, "physical");
INSERT INTO
tags(id, tag_name)
VALUES (9, "imaginative");
INSERT INTO
tags(id, tag_name)
VALUES (10, "restorative");
INSERT INTO
tags(id, tag_name)
VALUES (11, "rules-based");
INSERT INTO
tags(id, tag_name)
VALUES (12, "bio-based");
INSERT INTO
tags(id, tag_name)
VALUES (13, "perennial");
INSERT INTO
tags(id, tag_name)
VALUES (14, "full sun");
INSERT INTO
tags(id, tag_name)
VALUES (5, "partial shade");
INSERT INTO
tags(id, tag_name)
VALUES (16, "full shade");
INSERT INTO
tags(id, tag_name)
VALUES (17, "shrub");
INSERT INTO
tags(id, tag_name)
VALUES (18, "grass");
INSERT INTO
tags(id, tag_name)
VALUES (19, "vine");
INSERT INTO
tags(id, tag_name)
VALUES (20, "tree");
INSERT INTO
tags(id, tag_name)
VALUES (21, "flower");
INSERT INTO
tags(id, tag_name)
VALUES (22, "groundcover");
INSERT INTO
tags(id, tag_name)
VALUES (23, "fern");

和初始化。这段代码不包含错误,但我把它包括在内是为了后代。我是使用SQL的新手,不知道如何排除故障。抛出的错误是"Uncaught PDOException: SQLSTATE[HY000]: General error: 1 near ")":语法错误在第66行"(初始化文件)。这是实例化数据库连接的行。

 <?php
// Open a connection to an SQLite database stored in filename: $db_filename.
// Returns: Connection to database.
function open_sqlite_db($db_filename)
{
  if (!file_exists($db_filename)) {
    throw new Exception('Failed to open database. No such file: ' . $db_filename);
  }
  // database was already initialized. Just open it!
  $db_connection = new PDO('sqlite:' . $db_filename);
  $db_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  return $db_connection;
}
// Open a connection to an SQLite database stored in filename: $db_filename.
// If database does not exists, will execute .sql file from $init_sql_filename
// to create and initialize the database. No database is created if there is
// an error the initialization SQL.
// Returns: Connection to database.
// Example: $db = init_sqlite_db('db/site.sqlite', 'db/init.sql');
function init_sqlite_db($db_filename, $init_sql_filename)
{
  // If the init SQL script does not exist, quit!
  if (!file_exists($init_sql_filename)) {
    throw new Exception("No such file: " . $init_sql_filename);
  }
  // create checksum of initialization script.
  $init_sql = file_get_contents($init_sql_filename);
  $init_checksum = md5($init_sql);
  // checksum used to create the database
  $init_checksum_filename = $init_sql_filename . ".checksum";
  // If the database doesn't exist, then the existing checksum is invalid. Delete it.
  if (!file_exists($db_filename) && file_exists($init_checksum_filename)) {
    unlink($init_checksum_filename);
  }
  // If the database exists, but no checksum file exists, then we have a consistency problem with the DB.
  if (file_exists($db_filename) && !file_exists($init_checksum_filename)) {
    throw new Exception("No checksum for existing database. Please regenerate your database (delete .sqlite file).");
  }
  // Get the existing checksum and compare it the init checksum.
  if (file_exists($init_checksum_filename)) {
    $current_checksum = file_get_contents($init_checksum_filename);
    if ($init_checksum != $current_checksum) {
      throw new Exception("Database initialization script has changed. Please regenerate your database (delete " . $db_filename . ").");
    }
  }
  // If the database does not exist, create it!
  if (!file_exists($db_filename)) {
    error_log("  creating database " . $db_filename . " from " . $init_sql_filename);
    // Create new database
    $db = new PDO('sqlite:' . $db_filename);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    try {
      // initialize database using .sql script
      $db->beginTransaction();
      $result = $db->exec($init_sql);
      $db->commit();
      if ($result !== FALSE) {
        file_put_contents($init_checksum_filename, $init_checksum);
        return $db;
      }
    } catch (PDOException $exception) {
      // If we had an error, then the DB did not initialize properly,
      // so let's delete it!
      unlink($db_filename);
      error_log("  failed to initialize database " . $db_filename . ". check your initialization SQL: " . $init_sql_filename);
      throw $exception;
    }
  } else {
    error_log("  opening database " . $db_filename);
    // database was already initialized. Just open it!
    $db = new PDO('sqlite:' . $db_filename);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    return $db;
  }
  return NULL;
}
// Execute a query ($sql) against a database ($db).
// Returns query results if query was successful.
// Returns null if query was not successful.
function exec_sql_query($db, $sql, $params = array())
{
  error_log('  executing SQL: ' . $sql);
  $query = $db->prepare($sql);
  if ($query and $query->execute($params)) {
    return $query;
  }
  return NULL;
}

您的SQL包含错误。我直接在SQLFiddle中输入,结果显示错误。

当涉及到在单个表中插入多个条目时,您不需要使用多个INSERT语句,您可以用逗号分隔值。我在SQLFiddle中测试了更新后的SQL,结果与预期一致

下面是更新后的初始化文件:

CREATE TABLE plants (
  plant_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
  plant_name TEXT NOT NULL,
  genus TEXT NOT NULL
);

INSERT INTO
  plants (plant_id, plant_name, genus)
VALUES
  (1, 'Pink Muhly Grass', 'Muhlenbergia capillaris'),
  (2, 'Feather reed grass', 'Calamagrostis x acutiflora'),
  (3, 'Smooth Shadbush', 'Amelanchier laevis'),
  (4, 'Chestnut Oak', 'Quercus montana'),
  (5, 'Sideoats Grama', 'Bouteloua curipendula'),
  (6, 'Feverfew', 'Tanasetum parthenium'),
  (7, 'Prairie Cord Grass', 'Spartina pectinata'),
  (8, 'Christmas Fern', 'Polystichum acrostichoides'),
  (9, 'Climbing Hydrangea', 'Hydrangea anomala'),
  (10, 'New England Aster', 'Aster novae angliae'),
  (11, 'Nannyberry', 'Viburnum lentago'),
  (12, 'Hyssop', 'Hyssopus officinalis');
  
CREATE TABLE plant-tags (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
  plant_id INTEGER NOT NULL,
  tag_id INTEGER NOT NULL,
  FOREIGN KEY (plant_id) REFERENCES plants(plant_id)
  FOREIGN KEY (tag_id) REFERENCES tags(tag_id)
);
  
 INSERT INTO
    plant-tags(id, plant_id, tag_id)
VALUES 
    (1,1,4),
    (2,1,5), 
    (3,1,6), 
    (4,1,7),
    (5,1,8),
    (6,1,12), 
    (7,1,13),
    (8,1,14),
    (9,1,18),
    (10, 2, 4),    
    (11, 2, 5),    
    (12, 2, 6),    
    (13, 2, 7),    
    (14, 2, 8),    
    (15, 2, 9),    
    (16, 2, 10),    
    (17, 2, 11),    
    (18, 2, 12),    
    (19, 2, 13),    
    (20, 2, 14),    
    (21, 2, 18),    
    (22, 2, 3),
    (23, 3, 1),    
    (24, 3, 2),    
    (25, 3, 4),    
    (26, 3, 5),    
    (27, 3, 7),    
    (28, 3, 8),    
    (29, 3, 9),    
    (30, 3, 12),    
    (31, 3, 13),    
    (32, 3, 14),    
    (33, 3, 15),    
    (34, 3, 17),
    (35, 4, 1),    
    (36, 4, 3),    
    (37, 4, 5),    
    (38, 4, 6),
    (39, 4, 7),    
    (40, 4, 8), 
    (41, 4, 12),    
    (42, 4, 13), 
    (43, 4, 14),    
    (44, 4, 20),  
    (45, 5, 3),  
    (46, 5, 4),   
    (47, 5, 5),  
    (48, 5, 6),  
    (49, 5, 7),  
    (50, 5, 8),  
    (51, 5, 9),  
    (52, 5, 10), 
    (53, 5, 12),
    (54, 5, 13),
    (55, 5, 14),
    (56, 5, 18),
    (57, 6, 1),
    (58, 6, 2),
    (59, 6, 5),    
    (60, 6, 6),    
    (61, 6, 7),    
    (62, 6, 8),    
    (63, 6, 9),    
    (64, 6, 12),    
    (65, 6, 13),    
    (66, 6, 14),    
    (67, 6, 22),
    (68, 7, 3),    
    (69, 7, 4),    
    (70, 7, 6),    
    (71, 7, 7),    
    (72, 7, 8),    
    (73, 7, 10),    
    (74, 7, 12),    
    (75, 7, 14),    
    (76, 7, 15),    
    (77, 7, 18),
    (78, 8, 4),
    (79, 8, 5),
    (80, 8, 7),
    (81, 8, 9),
    (82, 8, 12),
    (83, 8, 13),
    (84, 8, 15),
    (85, 8, 16),
    (86, 8, 23),
    (87, 9, 2),
    (88, 9, 5),
    (89, 9, 7),
    (90, 9, 8),
    (91, 9, 10),
    (92, 9, 12),
    (93, 9, 13),
    (94, 9, 15),
    (95, 9, 16),
    (96, 9, 19),
    (97, 10, 1),
    (98, 10, 4),
    (99, 10, 6),
    (100, 10, 9),
    (101, 10, 12),
    (102, 10, 13),
    (103, 10, 14),
    (104, 10, 15),
    (105, 10, 21),
    (106, 11, 1),
    (107, 11, 2),
    (108, 11, 5),
    (109, 11, 7),
    (110, 11, 8),
    (111, 11, 12),
    (112, 11, 13),
    (113, 11, 14),
    (114, 11, 15),
    (115, 11, 17),
    (116, 12, 21),
    (117, 12, 1),
    (118, 12, 2),
    (119, 12, 4),
    (120, 12, 7),
    (121, 12, 8),
    (122, 12, 9),
    (123, 12, 12),
    (124, 12, 14),
    (125, 12, 16);
    
CREATE TABLE tags (
  tag_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
  tag_name TEXT NOT NULL,
);
INSERT INTO
    tags(id, tag_name)
VALUES
    (1, "edible"),
    (2, "scent"),
    (3, "sound"),
    (4, "tactile"),
    (5, "visual"),
    (6, "exploratory constructive"),
    (7, "exploratory sensory"),
    (8, "physical"),
    (9, "imaginative"),
    (10, "restorative"),
    (11, "rules-based"),
    (12, "bio-based"),
    (13, "perennial"),
    (14, "full sun"),
    (5, "partial shade"),
    (16, "full shade"),
    (17, "shrub"),
    (18, "grass"),
    (19, "vine"),
    (20, "tree"),
    (21, "flower"),
    (22, "groundcover"),
    (23, "fern");

最新更新