仅当 SQLite 表不存在时才创建它
问题描述:
我需要我的 PHP 应用程序才能创建 SQLite 表,但前提是它不存在.我该怎么办?
I need my PHP app to be able to create an SQLite table but only if it doesn't already exist. How should I go about it?
答
您可以使用:
CREATE TABLE IF NOT EXISTS <name> (
/* definition */
)
SQLite (http://www.sqlite.org/syntaxdiagrams.html#create-table-stmt)