当前位置:网站首页>SQLite modify column type
SQLite modify column type
2022-07-02 11:13:00 【Chinese descendants__】
brief introduction
sqlite Cannot modify column type directly , So you need to create a temporary table , First copy the data into the temporary table , Then create a new table , Then copy the data of the temporary table back .
Example
-- Create a temporary table sqlitestudio_temp_table, And with the table learn_info The data and structure are consistent
CREATE TABLE sqlitestudio_temp_table AS SELECT * FROM learn_info;
-- Delete the original table
DROP TABLE learn_info;
-- new table , The new instruction has modified the data type of the column
CREATE TABLE learn_info (
id INTEGER PRIMARY KEY AUTOINCREMENT,
type INT,
thought TEXT,
book INT,
chapter INT,
section INT,
number TEXT,
repeat INT DEFAULT 1,
failed_repeat INT DEFAULT 0,
star INT,
comment TEXT,
span INT,
update_time DATE DEFAULT (datetime('now', 'localtime') ),
version INT,
deleted INT
);
-- Insert the data of the temporary table into the new table , If the modified field cannot be inserted , You can get rid of that column
INSERT INTO learn_info (
id,
type,
thought,
book,
chapter,
section,
number,
repeat,
failed_repeat,
star,
comment,
span,
update_time,
version,
deleted
)
SELECT id,
type,
thought,
book,
chapter,
section,
number,
repeat,
failed_repeat,
star,
comment,
span,
update_time,
version,
deleted
FROM sqlitestudio_temp_table;
-- Delete temporary table
DROP TABLE sqlitestudio_temp_table;
边栏推荐
- Importerror: impossible d'importer le nom « graph» de « graphviz»
- Special topic of binary tree -- acwing 1497 Traversal of the tree (use post and mid order traversal to build a binary tree)
- ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
- Resources读取2d纹理 转换为png格式
- 从攻击面视角,看信创零信任方案实践
- PCL projection point cloud
- Special topic of binary tree -- acwing 47 Path with a certain value in binary tree (preorder traversal)
- Xiao Sha's pain (double pointer
- From Read and save in bag file Jpg pictures and PCD point cloud
- Use Huawei performance management service to configure the sampling rate on demand
猜你喜欢
![[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched](/img/5c/b0030fd5fbc07eb94013f2699c2a04.png)
[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched
![Binary tree topic -- Luogu p3884 [jloi2009] binary tree problem (DFS for binary tree depth BFS for binary tree width Dijkstra for shortest path)](/img/c2/bb85b681af0f78b380b1d179c7ea49.png)
Binary tree topic -- Luogu p3884 [jloi2009] binary tree problem (DFS for binary tree depth BFS for binary tree width Dijkstra for shortest path)

【深入浅出玩转FPGA学习2----设计技巧(基本语法)】

二叉树专题--AcWing 19. 二叉树的下一个节点(找树中节点的后继)

二叉树专题--洛谷 P1229 遍历问题(乘法原理 已知前、后序遍历求中序遍历个数)

Mongodb learning and sorting (condition operator, $type operator, limit() method, skip() method and sort() method)

Verilog 和VHDL有符号数和无符号数相关运算

华为快应用中如何实现同时传递事件对象和自定义参数

华为应用市场应用统计数据问题大揭秘

TIPC messaging3
随机推荐
Special topic of binary tree -- acwing 18 Rebuild the binary tree (construct the binary tree by traversing the front and middle order)
洛谷 P3398 仓鼠找 sugar(树上倍增 lca 判断树中两条路径是否相交 结论)
[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched
Approximate sum count (approximate
STM32单片机编程学习
sqlite 修改列类型
TIPC messaging3
QT learning diary 7 - qmainwindow
【深入浅出玩转FPGA学习2----设计技巧(基本语法)】
【深入浅出玩转FPGA学习4----漫谈状态机设计】
Verilog 和VHDL有符号数和无符号数相关运算
PCL extracts a subset from a point cloud
Luogu p5536 [xr-3] core city (greed + tree DP looking for the center of the tree)
二叉树专题--洛谷 P3884 [JLOI2009]二叉树问题(dfs求二叉树深度 bfs求二叉树宽度 dijkstra求最短路)
二.Stm32f407芯片GPIO编程,寄存器操作,库函数操作和位段操作
Multi line display and single line display of tqdm
QT学习日记7——QMainWindow
如何用list组件实现tabbar标题栏
One trick to quickly realize custom application titlebar
Internship report skywalking distributed link tracking?