Home > Database > Mysql Tutorial > body text

什么是SQLite_MySQL

PHP中文网
Release: 2016-05-27 14:29:35
Original
1458 people have browsed it

一、什么是SQLite

  SQLite是一款轻型的数据库,它的设计目标是嵌入式的,而且目前已经在很多嵌入式产品中使用了它,它占用资源非常的低,在嵌入式设备中,可能只需要几百K的内存就够了。

  SQLite支持Windows/Linux/Unix等等主流的操作系统,同时能够跟很多程序语言相结合,比如Tcl、PHP、Java等,还有ODBC接口,同样比起Mysql、PostgreSQL这两款开源世界著名的数据库管理系统来讲,它的处理速度比他们都快。

      SQLite虽然很小巧,但是支持的SQL语句不会逊色于其他开源数据库,同时它还支持事务处理功能等等。也有人说它象Microsoft的Access,有时候真的觉得有点象,但是事实上它们区别很大。比如SQLite支持跨平台,操作简单,能够使用很多语言直接创建数据库,而不象Access一样需要Office的支持。如果你是个很小型的应用,或者你想做嵌入式开发,没有合适的数据库系统,那么现在你可以考虑使用SQLite。

二、下载安装及使用SQLite

  SQLite官方地址:http://www.sqlite.org

  SQLite下载页面:http://www.sqlite.org/download.html/

  我们以Windows版本 sqlite-shell-win32-x86-3071000.zip (发布于2012-1-16) 为例介绍其安装及使用。

  下载后,将sqlite-shell-win32-x86-3071000.zip 解压缩至D:\SQLite 目录即完成安装。目录中只有一个文件 sqlite3.exe。

  打开一个CMD命令窗口。进入SQLite目录,输入 sqlite3 test.db,启动SQLite程序并创建一个名为test数据库。

  接着建一张名为category的表,表中有3个字段 分别是 categoryId、title、addtime。SQL语句如下:

  create table Category (CategoryId integer primary key autoincrement not null, Title text(50), 
  AddTime text(50));
Copy after login

  向Category表插入两条记录。语句如下:

  

insert into Category (Title,AddTime) values ('html-css', '2012-2-17');
  insert into Category (Title,AddTime) values ('javascript', '2012-2-17');
Copy after login

  接着读取刚才插入的记录。语句如下:

  

select * from Category;
Copy after login

  最后输入.quit 命令退出。 查看D:\sqlite目录,你会发现多了一个test.db 数据库文件。整个过程如图:


 

以上就是什么是SQLite_MySQL的内容,更多相关内容请关注PHP中文网(www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!