SQLite导出数据库至sql文件

news2024/9/20 3:30:27

SQLite是一款实现了自包含、无服务器、零配置、事务性SQL数据库引擎的软件库。SQLite是世界上部署最广泛的SQL数据库引擎。
SQLite 是非常小的,是轻量级的,完全配置时小于 400KiB,省略可选功能配置时小于250KiB。
SQLite 源代码不受版权限制。

Dbeaver等工具支持数据表导出为sql文件,但无法直接将数据库导出至整个sql文件中

1.软件包下载
  • 这里在Windows 10操作系统下配置,下载x64包。tools、ddl工具包下载,下载主页地址为:https://www.sqlite.org/download.html
    • sqlite-dll-win-x64-3450300.zip
    • sqlite-tools-win-x64-3450300.zip
      在这里插入图片描述
2.文件解压合并
  • 把下载的两个安装包解压到新建目录下,路径目录下最终共有五个文件,如下图所示:
    在这里插入图片描述
3.SQLite命令导出数据库至sql文件
  • 命令行及执行效果
.\sqlite-\sqlite3.exe db.healthclub .dump > ..\YouliTest\HeaClub.sql

在这里插入图片描述

4.SQLite其他命令
.exit	退出 sqlite 提示符。
.header(s) on|off	开启或关闭头部显示。
.help	显示消息。
.mode mode	设置输出模式,mode 可以是下列之一:
	csv 逗号分隔的值
	column 左对齐的列
	html html 的 <table> 代码
	insert table 表的 sql 插入(insert)语句
	line 每行一个值
	list 由 .separator 字符串分隔的值
	tabs 由 tab 分隔的值
	tcl tcl 列表元素
.nullvalue string	在 null 值的地方输出 string 字符串。
.quit	退出 sqlite 提示符。
.schema ?table?	显示 create 语句。如果指定了 table 表,则只显示匹配 like 模式的 table 表。
.separator string	改变输出模式和 .import 所使用的分隔符。
.show	显示各种设置的当前值。
.stats on|off	开启或关闭统计。
.tables ?pattern?	列出匹配 like 模式的表的名称。
.width num num	为 "column" 模式设置列宽度。
.timer on|off	开启或关闭 cpu 定时器。
  • 演示效果
D:\..\HealthClub>D:\..\sqlite-\sqlite3.exe db.healthclub
SQLite version 3.45.3 2024-04-15 13:34:05 (UTF-16 console I/O)
Enter ".help" for usage hints.
sqlite>
sqlite>
sqlite> .databases
main: D:\..\HealthClub\db.healthclub r/w
sqlite> .schema bbs_post
CREATE TABLE IF NOT EXISTS "bbs_post" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "title" varchar(20) NOT NULL, "content" text NOT NULL, "comment_num" integer NOT NULL, "read_num" integer NOT NULL, "is_essence" bool NOT NULL, "add_time" datetime NOT NULL, "author_id" integer NOT NULL REFERENCES "users_usermessage" ("id") DEFERRABLE INITIALLY DEFERRED, "board_id" integer NOT NULL REFERENCES "bbs_board" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE INDEX "bbs_post_author_id_04bf457a" ON "bbs_post" ("author_id");
CREATE INDEX "bbs_post_board_id_85a114b6" ON "bbs_post" ("board_id");
sqlite> .header on
sqlite> .mode column
sqlite> .timer on
sqlite> .schema bbs_post
CREATE TABLE IF NOT EXISTS "bbs_post" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "title" varchar(20) NOT NULL, "content" text NOT NULL, "comment_num" integer NOT NULL, "read_num" integer NOT NULL, "is_essence" bool NOT NULL, "add_time" datetime NOT NULL, "author_id" integer NOT NULL REFERENCES "users_usermessage" ("id") DEFERRABLE INITIALLY DEFERRED, "board_id" integer NOT NULL REFERENCES "bbs_board" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE INDEX "bbs_post_author_id_04bf457a" ON "bbs_post" ("author_id");
CREATE INDEX "bbs_post_board_id_85a114b6" ON "bbs_post" ("board_id");
sqlite> .show
        echo: off
         eqp: off
     explain: auto
     headers: on
        mode: column --wrap 60 --wordwrap off --noquote
   nullvalue: ""
      output: stdout
colseparator: "|"
rowseparator: "\n"
       stats: off
       width:
    filename: db.healthclub
sqlite> .separator row '\n'
sqlite> .nullvalue NULL
sqlite> .schema bbs_post
CREATE TABLE IF NOT EXISTS "bbs_post" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "title" varchar(20) NOT NULL, "content" text NOT NULL, "comment_num" integer NOT NULL, "read_num" integer NOT NULL, "is_essence" bool NOT NULL, "add_time" datetime NOT NULL, "author_id" integer NOT NULL REFERENCES "users_usermessage" ("id") DEFERRABLE INITIALLY DEFERRED, "board_id" integer NOT NULL REFERENCES "bbs_board" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE INDEX "bbs_post_author_id_04bf457a" ON "bbs_post" ("author_id");
CREATE INDEX "bbs_post_board_id_85a114b6" ON "bbs_post" ("board_id");
sqlite> .mode column;.headers on;.separator ROW "\n";.nullvalue NULL;select * from bbs_post
extra argument: "ROW"
sqlite> select * from bbs_post
   ...> ;
id  title        content                     comment_num  read_num  is_essence  add_time                    author_id  board_id
--  -----------  --------------------------  -----------  --------  ----------  --------------------------  ---------  --------
2   我想减肥         <p>有没有朋友一起减肥呢?</p>          2            7         0           2020-07-25 13:20:49.728140  6          1
3   希望我减肥成功      <p>已经买了课程了,希望我可以瘦身20~</p>  1            3         0           2020-07-28 20:14:18.626428  6          1
4   我开了减肥课程      <p>欢迎同学们来报名学习!</p>          0            2         0           2020-07-28 20:32:33.640089  4          1
5   111          <p>222</p>                  1            4         0           2020-07-29 00:13:16.005981  4          1
6   21232312345  <p>21232312345</p>          0            1         0           2024-04-20 22:26:08.160594  6          1
Run Time: real 0.006 user 0.000000 sys 0.000000
sqlite> select * from bbs_post;
id  title        content                     comment_num  read_num  is_essence  add_time                    author_id  board_id
--  -----------  --------------------------  -----------  --------  ----------  --------------------------  ---------  --------
2   我想减肥         <p>有没有朋友一起减肥呢?</p>          2            7         0           2020-07-25 13:20:49.728140  6          1
3   希望我减肥成功      <p>已经买了课程了,希望我可以瘦身20~</p>  1            3         0           2020-07-28 20:14:18.626428  6          1
4   我开了减肥课程      <p>欢迎同学们来报名学习!</p>          0            2         0           2020-07-28 20:32:33.640089  4          1
5   111          <p>222</p>                  1            4         0           2020-07-29 00:13:16.005981  4          1
6   21232312345  <p>21232312345</p>          0            1         0           2024-04-20 22:26:08.160594  6          1
Run Time: real 0.006 user 0.000000 sys 0.000000
sqlite> analyze bbs_post;
Run Time: real 0.011 user 0.000000 sys 0.000000
sqlite> .table
auth_group                          django_content_type
auth_group_permissions              django_migrations
auth_permission                     django_session
bbs_board                           reversion_revision
bbs_comment                         reversion_version
bbs_notify                          teachers_teacher
bbs_post                            users_banner
course_course                       users_userfavorite
course_courselist                   users_usermember
course_ctype                        users_usermessage
course_lesson                       users_usermessage_groups
course_video                        users_usermessage_user_permissions
django_admin_log                    users_usersign
sqlite> .header off
sqlite> select * from bbs_post;
2   我想减肥         <p>有没有朋友一起减肥呢?</p>          2            7         0           2020-07-25 13:20:49.728140  6          1
3   希望我减肥成功      <p>已经买了课程了,希望我可以瘦身20~</p>  1            3         0           2020-07-28 20:14:18.626428  6          1
4   我开了减肥课程      <p>欢迎同学们来报名学习!</p>          0            2         0           2020-07-28 20:32:33.640089  4          1
5   111          <p>222</p>                  1            4         0           2020-07-29 00:13:16.005981  4          1
6   21232312345  <p>21232312345</p>          0            1         0           2024-04-20 22:26:08.160594  6          1
Run Time: real 0.002 user 0.000000 sys 0.000000
sqlite> .show
        echo: off
         eqp: off
     explain: auto
     headers: off
        mode: column --wrap 60 --wordwrap off --noquote
   nullvalue: "NULL"
      output: stdout
colseparator: "row"
rowseparator: "\\n"
       stats: off
       width: 0 0 0 0 0 0 0 0 0
    filename: db.healthclub
sqlite> .mode tcl
sqlite> select * from bbs_post;
"2" "我想减肥" "<p>有没有朋友一起减肥呢?</p>" "2" "7" "0" "2020-07-25 13:20:49.728140" "6" "1"
"3" "希望我减肥成功" "<p>已经买了课程了,希望我可以瘦身20斤~</p>" "1" "3" "0" "2020-07-28 20:14:18.626428" "6" "1"
"4" "我开了减肥课程" "<p>欢迎同学们来报名学习!</p>" "0" "2" "0" "2020-07-28 20:32:33.640089" "4" "1"
"5" "111" "<p>222</p>" "1" "4" "0" "2020-07-29 00:13:16.005981" "4" "1"
"6" "21232312345" "<p>21232312345</p>" "0" "1" "0" "2024-04-20 22:26:08.160594" "6" "1"
Run Time: real 0.007 user 0.000000 sys 0.000000
sqlite> .mode column
sqlite> select * from bbs_post;
2   我想减肥         <p>有没有朋友一起减肥呢?</p>          2            7         0           2020-07-25 13:20:49.728140  6          1
3   希望我减肥成功      <p>已经买了课程了,希望我可以瘦身20~</p>  1            3         0           2020-07-28 20:14:18.626428  6          1
4   我开了减肥课程      <p>欢迎同学们来报名学习!</p>          0            2         0           2020-07-28 20:32:33.640089  4          1
5   111          <p>222</p>                  1            4         0           2020-07-29 00:13:16.005981  4          1
6   21232312345  <p>21232312345</p>          0            1         0           2024-04-20 22:26:08.160594  6          1
Run Time: real 0.007 user 0.000000 sys 0.000000
sqlite> .header on
sqlite> select * from bbs_post;
id  title        content                     comment_num  read_num  is_essence  add_time                    author_id  board_id
--  -----------  --------------------------  -----------  --------  ----------  --------------------------  ---------  --------
2   我想减肥         <p>有没有朋友一起减肥呢?</p>          2            7         0           2020-07-25 13:20:49.728140  6          1
3   希望我减肥成功      <p>已经买了课程了,希望我可以瘦身20~</p>  1            3         0           2020-07-28 20:14:18.626428  6          1
4   我开了减肥课程      <p>欢迎同学们来报名学习!</p>          0            2         0           2020-07-28 20:32:33.640089  4          1
5   111          <p>222</p>                  1            4         0           2020-07-29 00:13:16.005981  4          1
6   21232312345  <p>21232312345</p>          0            1         0           2024-04-20 22:26:08.160594  6          1
Run Time: real 0.006 user 0.000000 sys 0.000000
sqlite> .show
        echo: off
         eqp: off
     explain: auto
     headers: on
        mode: column --wrap 60 --wordwrap off --noquote
   nullvalue: "NULL"
      output: stdout
colseparator: " "
rowseparator: "\n"
       stats: off
       width: 0 0 0 0 0 0 0 0 0
    filename: db.healthclub
sqlite> .stats on
sqlite> select * from bbs_post;
id  title        content                     comment_num  read_num  is_essence  add_time                    author_id  board_id
--  -----------  --------------------------  -----------  --------  ----------  --------------------------  ---------  --------
2   我想减肥         <p>有没有朋友一起减肥呢?</p>          2            7         0           2020-07-25 13:20:49.728140  6          1
3   希望我减肥成功      <p>已经买了课程了,希望我可以瘦身20~</p>  1            3         0           2020-07-28 20:14:18.626428  6          1
4   我开了减肥课程      <p>欢迎同学们来报名学习!</p>          0            2         0           2020-07-28 20:32:33.640089  4          1
5   111          <p>222</p>                  1            4         0           2020-07-29 00:13:16.005981  4          1
6   21232312345  <p>21232312345</p>          0            1         0           2024-04-20 22:26:08.160594  6          1
Memory Used:                         255016 (max 268976) bytes
Number of Outstanding Allocations:   773 (max 838)
Number of Pcache Overflow Bytes:     8200 (max 12296) bytes
Largest Allocation:                  87360 bytes
Largest Pcache Allocation:           4104 bytes
Lookaside Slots Used:                104 (max 123)
Successful lookaside attempts:       2436
Lookaside failures due to size:      116
Lookaside failures due to OOM:       1066
Pager Heap Usage:                    44112 bytes
Page cache hits:                     58
Page cache misses:                   8
Page cache writes:                   3
Page cache spills:                   0
Schema Heap Usage:                   22576 bytes
Statement Heap/Lookaside Usage:      21640 bytes
Fullscan Steps:                      4
Sort Operations:                     0
Autoindex Inserts:                   0
Virtual Machine Steps:               61
Reprepare operations:                0
Number of times run:                 1
Memory used by prepared stmt:        21640
Run Time: real 0.013 user 0.000000 sys 0.000000
sqlite> .width 6
sqlite> select * from bbs_post;
id      title        content                     comment_num  read_num  is_essence  add_time                    author_id  board_id
------  -----------  --------------------------  -----------  --------  ----------  --------------------------  ---------  --------
2       我想减肥         <p>有没有朋友一起减肥呢?</p>          2            7         0           2020-07-25 13:20:49.728140  6          1
3       希望我减肥成功      <p>已经买了课程了,希望我可以瘦身20~</p>  1            3         0           2020-07-28 20:14:18.626428  6          1
4       我开了减肥课程      <p>欢迎同学们来报名学习!</p>          0            2         0           2020-07-28 20:32:33.640089  4          1
5       111          <p>222</p>                  1            4         0           2020-07-29 00:13:16.005981  4          1
6       21232312345  <p>21232312345</p>          0            1         0           2024-04-20 22:26:08.160594  6          1
Memory Used:                         255016 (max 268976) bytes
Number of Outstanding Allocations:   773 (max 838)
Number of Pcache Overflow Bytes:     8200 (max 12296) bytes
Largest Allocation:                  87360 bytes
Largest Pcache Allocation:           4104 bytes
Lookaside Slots Used:                104 (max 123)
Successful lookaside attempts:       2506
Lookaside failures due to size:      117
Lookaside failures due to OOM:       1086
Pager Heap Usage:                    44112 bytes
Page cache hits:                     2
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Schema Heap Usage:                   22576 bytes
Statement Heap/Lookaside Usage:      21640 bytes
Fullscan Steps:                      4
Sort Operations:                     0
Autoindex Inserts:                   0
Virtual Machine Steps:               61
Reprepare operations:                0
Number of times run:                 1
Memory used by prepared stmt:        21640
Run Time: real 0.010 user 0.000000 sys 0.000000
sqlite>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1612932.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

分类神经网络3:DenseNet模型复现

目录 DenseNet网络架构 DenseNet部分实现代码 DenseNet网络架构 论文原址&#xff1a;https://arxiv.org/pdf/1608.06993.pdf 稠密连接神经网络&#xff08;DenseNet&#xff09;实质上是ResNet的进阶模型&#xff08;了解ResNet模型请点击&#xff09;&#xff0c;二者均是…

数字阅览室解决方案

一、方案概述 “数字阅览室”概念一经提出&#xff0c;就得到了广泛的关注&#xff0c;纷纷组织力量进行探讨、研究和开发&#xff0c;进行各种模型的试验。随着数字地球概念、技术、应用领域的发展&#xff0c;数字阅览室已成为数字地球家庭的成员&#xff0c;为信息高速公路…

Flowable 基本用法

一. 什么是Flowable Flowable 是一个基于 Java 的开源工作流引擎&#xff0c;用于实现和管理业务流程。它提供了强大的工作流引擎和一套丰富的工具&#xff0c;使开发人员能够轻松地建模、部署、执行和监控各种类型的业务流程。Flowable 是 Activiti 工作流引擎的一个分支&am…

LeetCode-电话号码的字母组合(回溯)

每日一题 今天刷到的是一道利用回溯来解决的题&#xff0c;不过稍微有点复杂&#xff0c;并且我也有一段时间没有做回溯了&#xff0c;所有在解题时也是思考了一段时间。 题目要求 给定一个仅包含数字 2-9 的字符串&#xff0c;返回所有它能表示的字母组合。答案可以按 任意…

常见现代卷积神经网络(ResNet, DenseNet)(Pytorch 11)

一 批量规范化&#xff08;batch normalization&#xff09; 训练深层神经网络是十分困难的&#xff0c;特别是在较短的时间内使他们收敛更加棘手。批量规范化&#xff08;batch normalization&#xff09;是一种流行且有效的技术&#xff0c;可持续加速深层网络的收敛速度。 …

网络原理-UDP和TCP

在传输层中有两个非常重要的协议&#xff0c;UDP和TCP&#xff0c;现在就来研究一下这两个协议。 UDP 报文格式 我们观察可以发现&#xff0c;里面UDP报文长度为2个字节&#xff0c;那么是多少呢&#xff1f;我们需要快速反应如下固定字节数据类型的取值范围&#xff1a; 字…

【融合ChatGPT等AI模型】Python-GEE遥感云大数据分析、管理与可视化及多领域应用

随着航空、航天、近地空间遥感平台的持续发展&#xff0c;遥感技术近年来取得显著进步。遥感数据的空间、时间、光谱分辨率及数据量均大幅提升&#xff0c;呈现出大数据特征。这为相关研究带来了新机遇&#xff0c;但同时也带来巨大挑战。传统的工作站和服务器已无法满足大区域…

anaconda配置的环境对应的地址查看,环境安装位置

打开conda指令窗口 这个和上面的都一样&#xff0c;哪个都行 点开后&#xff0c;输入 conda env list 这里显示的就是自己的每个环境对应的地址了

python_4

def reverse(number):a str(number) # 将输入的数字转成字符串print(f"反向输出:{a[::-1]}") # 将字符串通过切片反向输出number int(input("输入整数:")) reverse(number)import mathdef isValid(side1, side2, side3):# 根据"两边之和大于第三边…

安装mmsegmentation默认主分支main

安装时间2024.4.21 mmsegmentation新版本main分支&#xff08;v1.2.2&#xff09; 安装过程 conda create --name openmmlab python3.8 -y conda activate openmmlab// 很关键&#xff0c;可以避免mmcv版本问题 pip install torch1.10.1cu113 torchvision0.11.2cu113 torcha…

明日周刊-第7期

转眼间就又快到了五一假期&#xff0c;小长假有什么计划吗。封面配图是杭州高架上的月季花&#xff0c;非常好看。 文章目录 一周热点资源分享言论歌曲推荐 一周热点 鸿蒙系统持续扩大影响力&#xff1a;近期&#xff0c;华为官方宣布广东省已有超过600款应用加入鸿蒙系统&…

文献速递:深度学习胶质瘤诊断---使用深度学习在 MRI 图像中进行低级别胶质瘤的脑肿瘤分割和分级

Title 题目 Brain tumor segmentation and grading of lower-grade glioma using deeplearning in MRI images 使用深度学习在 MRI 图像中进行低级别胶质瘤的脑肿瘤分割和分级 01文献速递介绍 胶质瘤是最常见的脑肿瘤&#xff0c;根据肿瘤的恶性程度和生长速率具有不同的分级…

如何在PostgreSQL中使用pg_stat_statements插件进行SQL性能统计和分析?

文章目录 一、启用pg_stat_statements插件二、查看统计信息三、定期重置统计信息四、注意事项 PostgreSQL中的pg_stat_statements是一个强大的插件&#xff0c;用于追踪执行时间最长的SQL语句。通过它&#xff0c;我们可以获取有关SQL语句执行频率、总执行时间、平均执行时间等…

2024团体程序设计天梯赛L1-104 九宫格

题目链接L1-104 九宫格 #include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int n, mapp[10][10], a[10]; int dx[10]{0, 1, 1, 1, 4, 4, 4, 7, 7, 7}; int dy[10]{0, 1, 4, 7, 1, 4, 7, 1, 4, 7}; b…

HTML:Form表单控件主要标签及属性。name属性,value属性,id属性详解。表单内容的传递流程,get和post数据传递样式。表单数据传递实例

form表单 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>Document</title> </head> &…

前端项目的导入和启动

安装依赖 前端安装依赖只需要在控制台执行“npm i”即可。Tips&#xff1a;当我们执行的时候&#xff0c;有时候会很慢。可以考虑使用yarn或者pnpm。然而使用yarn或者pnpm有时候有一些莫名其妙的问题。所以还是得使用npm&#xff0c; 这个时候可以通过更换镜像源为淘宝镜像源。…

递归排列枚举(c++)

全部排列问题 输入 n 输出 1…n 个数的全部排列。全部排列中&#xff0c;数字可以重复 。 例如 输入 3 输出全部排列的结果如下&#xff1a;111、112、113、121、122、123、131、132、133、211、212、213、221、222、223、231、232、233、311、312、313、321、322、323、33…

红外接收器的原理以及在STM32和51单片机中的应用

基本介绍&#xff1a; 红外接收器是一种用于接收红外线信号的装置&#xff0c;常见于各种电子设备中&#xff0c;如电视遥控器、空调遥控器等。它能够接收来自发射器发送的红外信号&#xff0c;并将其转换成电信号&#xff0c;以便设备进行相应的操作。红外接收器通常包含红外光…

C语言语法进阶

条件运算符 条件运算符是 C 语言中唯一的一种三目运算符。三目运算符代表有三个操作数&#xff1b;双目 运算符代表有两个操作数&#xff0c;如逻辑与运算符就是双目运算符&#xff1b;单目运算符代表有一个操作数&#xff0c; 如逻辑非运算符就是单目运算符。运算符也称操作符…

亚马逊---设计安全架构

会从以下三个方面展开&#xff1a; 1、AWS资源访问安全 2、应用程序负载的网络安全 3、云中数据的安全 责任共担模式 就像租房子&#xff08;房东和你的责任&#xff09; AWS资源访问安全 需要掌握以下几点&#xff1a; 1、跨多个账户的访问控制和管理 2、AWS联合访问和身份服…