SQLite常用SQL命令

SQLite常用SQL命令,第1张

概述~~~~~关于SQLite的一些常用的SQL命令~~~~~~~~~~~   创建数据库表:   CREATE TABLE IF NOT EXISTS table-name ( column-def1, column-def2 )   table-name:指的是数据库表的名称 column-def:指的是表的列定义 其中 column-def又分为: column-name type-name c

~~~~~关于sqlite的一些常用的sql命令~~~~~~~~~~~

创建数据库表:

CREATE table IF NOT EXISTS

table-name ( column-def1,column-def2)

table-name:指的是数据库表的名称

column-def:指的是表的列定义

其中 column-def又分为: column-name type-name column-constraint

type-name:常用的有 INTEGER / VARCHAR

其中column-constraint:常用的形式有 PRIMARY KEY

--------------------------------------------------------------------

向现有的数据库表格中插入记录:

INSERT INTO

table-name (column-name1,column-name2) VALUES ( expr1,expr2)

------------------------------------------------------------------------

从现有的数据库中删除记录:

DELETE FROM

squalifIEd-table-name WHERE expr

-------------------------------------------------------------------------

删除数据库的表:

DROP table IF EXISTS table-name

说明:The DROP table statement removes a table added with the CREATE TABLE statement. The name specifIEd is the table name. The dropped table is completely removed from the database schema and the disk file. The table can not be recovered. All indices and triggers associated with the table are also deleted.

------------------------------------------------------------------------------

在现有的数据库表中进行修改记录:

UPDATE qualifIEd-table-name SET column-name = expr WHERE expr

说明:The UPDATE statement is used to change the value of columns in selected rows of a table. Each assignment in an UPDATE specifIEs a column name to the left of the equals sign and an arbitrary Expression to the right. The Expressions may use the values of other columns. All Expressions are evaluated before any assignments are made. A WHERE clause can be used to restrict which rows are updated.

------------------------------------------------------------------------------

从现有的表格中选择符合条件的记录:

SELECT (disTINCT/ALL) FROM join-source WHERE expr GROUP-BY ordering-term HAING expr ORDER BY ordering-term

总结

以上是内存溢出为你收集整理的SQLite常用SQL命令全部内容,希望文章能够帮你解决SQLite常用SQL命令所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/1177803.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存