数据库(Database)是按照数据结构来组织、存储和管理数据的仓库,它产生于距今六十多年前,随着信息技术和市场的发展,特别是二十世纪九十年代以后,数据管理不再仅仅是存储和管理数据,而转变成用户所需要的各种数据管理的方式。数据库有很多种类型,从最简单的存储有各种数据的表格到能够进行海量数据存储的大型数据库系统都在各个方面得到了广泛的应用。
SQL是Structured Query Language(结构化查询语言)的缩写。SQL是专为数据库而建立的操作命令集,是一种功能齐全的数据库语言。在使用它时,只需要发出“做什么”的命令,“怎么做”是不用使用者考虑的。SQL功能强大、简单易学、使用方便,已经成为了数据库操作的基础,并且现在几乎所有的数据库均支持SQL。
SQL数据库的数据体系结构基本上是三级结构,但使用术语与传统关系模型术语不同。在SQL中,关系模式(模式)称为“基本表”(base table);存储模式(内模式)称为“存储文件”(stored file);子模式(外模式)称为“视图”(view);元组称为“行”(row);属性称为“列”(column)。
1)非过程化语言 2)统一的语言 3)是所有关系数据库的公共语言
注:所需最小 RAM 为 512MB,而所需最小交换空间为 1GB。对于 RAM 小于或等于 2GB 的系统,交换空间应为 RAM 数量的两倍;对于 RAM 大于 2GB 的系统,交换空间应为 RAM 数量的一到两倍。
至少需要400M可用空间
[fanmaolin@Centeros ~]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 38G 7.2G 29G 21% / tmpfs 491M 72K 491M 1% /dev/shmhttp://www.sqlite.org/download.html
[fanmaolin@Centeros ~]$ rz rz waiting to receive. Starting zmodem transfer. Press Ctrl+C to cancel. Transferring sqlite-autoconf-3200000.tar.gz... 100% 2505 KB 2505 KB/s 00:00:01 0 Errors ?[fanmaolin@Centeros ~]$ ls Desktop Downloads fl2440 Pictures src test x.c dir dropbear-0.53.1 git Public tcode1 tftp zuoye Documents dropbear-0.53.1.tar.bz2 Music sqlite-autoconf-3200000.tar.gz Templates Videos 桌面 [fanmaolin@Centeros ~]$ tar -zxvf sqlite-autoconf-3200000.tar.gz 省略 [fanmaolin@Centeros ~]$ cd sqlite-autoconf-3200000 [fanmaolin@Centeros sqlite-autoconf-3200000]$ ./configure 省略 [fanmaolin@Centeros sqlite-autoconf-3200000]$ make 省略 [fanmaolin@Centeros sqlite-autoconf-3200000]$ sudo make install 省略.tables+name
sqlite> .tables mytable mytable向表中导入文件的数据
[fanmaolin@Centeros sqlite-autoconf-3200000]$ sqlite3 mydbtest SQLite version 3.20.0 2017-08-01 13:24:15 Enter ".help" for usage hints. sqlite> select * from mytable;#导入前查询 fanmaolin|18 zhanghuan|17 sqlite> .import test.txt mytable #导入数据 sqlite> select * from mytable;#导入后查询 fanmaolin|18 zhanghuan|17 zhang san|20 li si|19 wang wu|17 wang ma|21打印SQLite环境变量
sqlite> .show echo: off eqp: off explain: auto headers: off mode: list nullvalue: "" output: stdout colseparator: "|" rowseparator: "\n" stats: off width: filename: mydbtest sqlite> .q按上下键可以让历史命令回调
工具下载地址: http://download.csdn.NET/detail/sharqueen/5433087
[fanmaolin@Centeros ~]$ tar -zvxf rlwrap-0.30.tar.gz 省略 [fanmaolin@Centeros ~]$ cd rlwrap-0.30 [fanmaolin@Centeros rlwrap-0.30]$ ./configure 省略 [fanmaolin@Centeros rlwrap-0.30]$ make 省略 [fanmaolin@Centeros rlwrap-0.30]$ sudo make install 省略 [fanmaolin@Centeros rlwrap-0.30]$ rlwrap Usage: rlwrap [options] command ... Options: -a[password:] --always-readline[=password:] -A --ansi-colour-aware -b <chars> --break-chars=<chars> -c --complete-filenames -C <name|N> --command-name=<name|N> -D <0|1|2> --history-no-dupes=<0|1|2> -f <completion list> --file=<completion list> -F <format string> --history-format=<format string> -h --help -H <file> --history-filename=<file> -i --case-insensitive -l <file> --logfile=<file> -n --no-warnings -p[ANSI colour spec] --prompt-colour[=ANSI colour spec] -P <input> --pre-given=<input> -q <chars> --quote-characters=<chars> -m[newline substitute] --multi-line[=newline substitute] -r --remember -v --version -s <N> --histsize=<N> (negative: readonly) -t <name> --set-term-name=<name> bug reports, suggestions, updates: http://utopia.knoware.nl/~hlub/uck/rlwrap/安装完成
**如果不想在每次使用前加rlwrap,则需要在~/.bash_profile下 添加: alias sqlite3=’rlwrap sqlite3’**
[fanmaolin@Centeros ~]$ vim ~/.bash_profile alias sqlite3='rlwrap sqlite3' #添加 [fanmaolin@Centeros ~]$ source ~/.bash_profile查看效果:
[fanmaolin@Centeros ~]$ sqlite3 SQLite version 3.20.0 2017-08-01 13:24:15 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite>如进行插入数据等操作时,结尾要记住加“;”
sqlite> insert into mytable values("fanmaolin",18); 进行退出操作时。前面要加“.” sqlite> .q
不必惊慌,淡定的输入“;”即可解决困境
...> ; Error: near "vim": syntax error sqlite>参考链接:http://blog.csdn.net/lyx_win/article/details/52227377 http://blog.csdn.net/xiongzhizhu/article/details/52311991