---
title: "Sqlite 小笔记"
author: "Crabby"
date: "2012-05-26T00:25:48Z"
tags: ["SQLite"]
categories: ["数据库"]
slug: "sqlite"
draft: false
lastmod: "2012-06-05T17:02:02Z"
id: 1541623
url: "https://crabby.iteye.com/blog/1541623"
---

1.如何查询Sqlite 数据库中的所有表信息
From within a c/c++ program (or a scritpt using tcl/Ruby/Perl/Python bindings),you can get access to table and index names by doing a select on a special table named "SQULITE_MASTER",Every SQLite database has an SQLITE_MASTER table that defines the schema for the database ;

比如：
sqlite> select name from sqlite_master where type='table' order by name;
 name = carts
 name = line_items
 name = orders
 name = products
 name = schema_migrations
 name = sqlite_sequence

 >>>>>=======================================
 或者直接使用此命令 .tables
 或者使用简写 .tab
sqlite> .tables
carts              orders             schema_migrations
line_items         products           users         

2.如何删除Sqlite 数据库中某一张表中的所有数据
命令 delete from table_name;
sqlite > delete from users;