SQLite点滴

SQLite点滴,第1张

概述--创建表: SL_Register_InfoCREATE TABLE [SL_Register_Info] ( [RegID] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, [UserID] INT NOT NULL CONSTRAINT [ForeingKey_UserID] REFERENCES [SL_User_Info]([UserI
--创建表: SL_Register_InfoCREATE table [SL_Register_Info] (  [RegID] INTEGER NOT NulL PRIMARY KEY autoINCREMENT,[UserID] INT NOT NulL CONSTRAINT [ForeingKey_UserID] REFERENCES [SL_User_Info]([UserID]) ON DELETE CASCADE ON UPDATE CASCADE,[MachineCode] VARCHAR(128),[RegCode] VARCHAR(200),[RegType] INT NOT NulL DEFAulT (1),[RegDate] DATE DEFAulT (datetime(CURRENT_TIMESTAMP,'localtime')),[EndRegDate] DATE,[AllowMaxIns] INT DEFAulT (0));--设置唯一键CREATE UNIQUE INDEX [Unique_User] ON [SL_Register_Info] ([UserID],[MachineCode]);--创建表:SL_User_InfoCREATE table [SL_User_Info] (  [UserID] INTEGER NOT NulL PRIMARY KEY autoINCREMENT,[Username] VARCHAR(50) NOT NulL,[PassWord] VARCHAR(20) NOT NulL,[BindType] INTEGER NOT NulL DEFAulT (0),[Telephone] VARCHAR(20),[QQ] VARCHAR(20),[RegisterDate] DATETIME DEFAulT (datetime(CURRENT_TIMESTAMP,[ReMark] VARCHAR(200));--设置唯一键CREATE UNIQUE INDEX [Unique_Username] ON [SL_User_Info] ([Username]);--创建视图CREATE VIEW [SL_User_Reg_VIEw] AS select A.UserID AS 用户编号,Username AS 用户名,BindType AS 绑定类型,B.MachineCode AS 机器码,B.RegCode AS 注册码,B.RegType AS 注册类型,B.RegDate AS 注册日期 from SL_User_info AS A left JOIN      SL_Register_Info AS B ON A.UserID = B.UserID;--使用事务BEGIN TRANSACTION;	--开始事务UPDATE SL_User_Info SET Username = 'ManSoy' WHERE UserID = 2;COMMIT TRANSACTION;	--提交事务BEGIN TRANSACTION;	--开始事务UPDATE SL_User_Info SET Username = 'ManSoy1' WHERE UserID = 2;RolLBACK TRANSACTION	--回滚事务
总结

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

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

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

原文地址: http://outofmemory.cn/sjk/1175143.html

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

发表评论

登录后才能评论

评论列表(0条)

保存