仅当 SQLite 表不存在时才创建它 [英] Creating an SQLite table only if it doesn't already exist

查看:24
本文介绍了仅当 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)

这篇关于仅当 SQLite 表不存在时才创建它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆