当前位置:网站首页>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;
边栏推荐
- [in simple terms, play with FPGA learning 3 ----- basic grammar]
- V2x SIM dataset (Shanghai Jiaotong University & New York University)
- TIPC Cluster5
- php中self和static在方法中的区别
- Pit of the start attribute of enumrate
- 金山云——2023届暑期实习
- TIPC protocol
- [ark UI] implementation of the startup page of harmonios ETS
- I STM32 development environment, keil5/mdk5.14 installation tutorial (with download link)
- 【ARK UI】HarmonyOS ETS的启动页的实现
猜你喜欢
![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)

Iii. Système de démarrage et d'horloge à puce

V2x SIM dataset (Shanghai Jiaotong University & New York University)
![[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

Nodejs+express+mysql simple blog building

Use Huawei performance management service to configure the sampling rate on demand

How does the whole network display IP ownership?

Hdu1236 ranking (structure Sorting)

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

Hdu1228 a + B (map mapping)
随机推荐
高德根据轨迹画线
Nodejs+express+mysql simple blog building
一.STM32的开发环境,keil5/MDK5.14安装教程(附下载链接)
TIPC 寻址2
计算序列之和
String (Analog
ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
Luogu p4281 [ahoi2008] emergency gathering / gathering (tree doubling LCA)
Luogu p5536 [xr-3] core city (greed + tree DP looking for the center of the tree)
The most detailed MySQL installation tutorial
二叉树专题--AcWing 3384. 二叉树遍历(已知先序遍历 边建树 边输出中序遍历)
Why does LabVIEW lose precision in floating point numbers
[AGC] how to solve the problem that the local display of event analysis data is inconsistent with that in AGC panel?
Thanos Receiver
【深入浅出玩转FPGA学习2----设计技巧(基本语法)】
【深入浅出玩转FPGA学习3-----基本语法】
[play with FPGA learning 4 in simple terms ----- talk about state machine design]
Win11 arm system configuration Net core environment variable
How to transfer event objects and user-defined parameters simultaneously in Huawei express applications
JVM garbage collector