Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/dvanmosselbeen/Docs/local_svn/guicms/top_page.php on line 218

Warning: include(http://dvm.zapto.org:3334/~dvanmosselbeen/guicms/main_menu.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/dvanmosselbeen/Docs/local_svn/guicms/top_page.php on line 218

Warning: include() [function.include]: Failed opening 'http://dvm.zapto.org:3334/~dvanmosselbeen/guicms/main_menu.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/dvanmosselbeen/Docs/local_svn/guicms/top_page.php on line 218
         
 
[Go Home]
[Rotated Banner]
   
   
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/dvanmosselbeen/Docs/local_svn/guicms/top_page.php on line 190

Warning: include(http://dvm.zapto.org:3334/~dvanmosselbeen/guicms//lib/sublinks.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/dvanmosselbeen/Docs/local_svn/guicms/top_page.php on line 190

Warning: include() [function.include]: Failed opening 'http://dvm.zapto.org:3334/~dvanmosselbeen/guicms//lib/sublinks.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/dvanmosselbeen/Docs/local_svn/guicms/top_page.php on line 190
   
         
 

Little sqlite reference

Article number : 114
Created Time : 2006-10-17 15:47:53
Last Modified : 2007-09-01 16:09:51
Type : Database

Description:
A little sqlite reference. This article is not intended to be are complete. But almost basic informations are here

Quick links in this article

Introduction

If we not need a sophisticated client/server database system, no multiple clients access, sqlite is the thing. It's easy to use, easy to setup, easy to manage, it's really not to sophisticated.

Ideal if you want to integrate a database system in your own application. There are several programming language that have modules to use sqlite.

Installing sqlite

On a Debian box

We first always update the list of packages and then upgrade all the packages before installing new software. We also install the additional documentation that are available. Maybe, once you have read the documentation and no more need it. You can easy remove the sqlite3-doc package.

apt-get update && apt-get upgrade && install sqlite3 sqlite3-doc

On a Windows box

It's just a matter to fetch the zip archieve of the website, extract it somewhere and execute the sqlite application from a command prompt.

Probably you want to get the installer, so that it install the stuff on the right place, modify the $PATH variable and such.

Checking the docs

Like we have installed the sqlite3-doc packages. It's best that we first read the doc. The docs are located in /usr/share/doc/sqlite3-doc/index.html. You can find this out with dpkg -L sqlite3-doc.

It's also good to check the website of sqlite. Probably you get there up to date news about the product. Also are there are bit more informations than provided in the additional 'sqlite3-doc' package.

Datatypes

  • NULL The value is a NULL value.
  • INTEGER The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.
  • REAL The value is a floating point value, stored as an 8-byte IEEE floating point number.
  • TEXT The value is a text string, stored using the database encoding (UTF-8, UTF-16BE or UTF-16-LE).
  • BLOB The value is a blob of data, stored exactly as it was input.

sqlite in the cli

We first always update the list of packages and then upgrade all the packages before installing new software.

Creating a database

sqlite3 test.db

Or for the personalData.db example:

sqlite3 personalData.db

Creating a table

CREATE TABLE examp(
    one text,
    two int);

Or for the personalData.db example:

CREATE TABLE contacts (
    id int,
    name text,
    forname text,
    address text,
    city text,
    tel text,
    gsm text);

Insert data in the table

INSERT INTO examp VALUES('Hello', World',99);

We insert again an record in the database, so we have a bit more data that we can play with.

INSERT INTO examp VALUES('Python Flying Cyrcus',99);

Or for the personalData.db example:

INSERT INTO contacts VALUES ('1', 'Bart', 'Simpson', 'Springfield street 5', 'Springfield', '000-000.00.00', '000-00.00.00');
INSERT INTO contacts VALUES ('2', 'Lisa', 'Simpson', 'Springfield street 5', 'Springfield', '000-000.00.00', '000-00.00.00');
INSERT INTO contacts VALUES ('1', 'Magie', 'Simpson', 'Springfield street 5', 'Springfield', '000-000.00.00', '000-00.00.00');
INSERT INTO contacts VALUES ('1', 'Magie', 'Simpson', 'Springfield street 5', 'Springfield', '000-000.00.00', '000-00.00.00');
INSERT INTO contacts VALUES ('1', 'Homer', 'Simpson', 'Springfield street 5', 'Springfield', '000-000.00.00', '000-00.00.00');

Select data from an table

SELECT * FROM examp;

But we can also take the fields we want:

SELECT one FROM examp;

Delete data from a table

DELETE FROM examp WHERE two<50;

Update data from a table

UPDATE examp SET one = 'ONE' WHERE one == 'one';

Drop a table

If you may need to delete a table.

DROP TABLE companies_company;

Alter a table

I'm not yet sure about it:

.table ALTER TABLE companies_company;

Getting some info

Get help:

.help

.explain

EXPLAIN INSERT INTO examp VALUES('Hello, World!',99);

EXPLAIN SELECT * FROM examp;

See also:

sqlite and Python

There are a Python module to access the content of a sqlite database. So that you easy can program an application that do some things with the sqlite database.

Comments leave by users:

No comments leaved...

Add an comment:

Note: Please be sure you fill the right values for the verification field, if same values not match, your message will be are loosed. Maybe make a copy of that comments before sending it. Thanks to the spammers for this implementation! Badwords and spam are logged!

Name:
Email:
Comments:
 



Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/dvanmosselbeen/Docs/local_svn/guicms/dbconnect.inc on line 2

Warning: include(http://dvm.zapto.org:3334/~dvanmosselbeen/guicms/vars.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/dvanmosselbeen/Docs/local_svn/guicms/dbconnect.inc on line 2

Warning: include() [function.include]: Failed opening 'http://dvm.zapto.org:3334/~dvanmosselbeen/guicms/vars.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/dvanmosselbeen/Docs/local_svn/guicms/dbconnect.inc on line 2

Warning: include(html/boxes/box_login.php) [function.include]: failed to open stream: Permission denied in /home/dvanmosselbeen/Docs/local_svn/guicms/right_menu.inc on line 19

Warning: include() [function.include]: Failed opening 'html/boxes/box_login.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/dvanmosselbeen/Docs/local_svn/guicms/right_menu.inc on line 19

Warning: include(html/boxes/box_last_articles.php) [function.include]: failed to open stream: Permission denied in /home/dvanmosselbeen/Docs/local_svn/guicms/right_menu.inc on line 19

Warning: include() [function.include]: Failed opening 'html/boxes/box_last_articles.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/dvanmosselbeen/Docs/local_svn/guicms/right_menu.inc on line 19

Warning: include(html/boxes/box_last_news.php) [function.include]: failed to open stream: Permission denied in /home/dvanmosselbeen/Docs/local_svn/guicms/right_menu.inc on line 19

Warning: include() [function.include]: Failed opening 'html/boxes/box_last_news.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/dvanmosselbeen/Docs/local_svn/guicms/right_menu.inc on line 19

Warning: include(html/boxes/box_last_links.php) [function.include]: failed to open stream: Permission denied in /home/dvanmosselbeen/Docs/local_svn/guicms/right_menu.inc on line 19

Warning: include() [function.include]: Failed opening 'html/boxes/box_last_links.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/dvanmosselbeen/Docs/local_svn/guicms/right_menu.inc on line 19

Warning: include(modules/sex_commander/box_sex_commander.php) [function.include]: failed to open stream: Permission denied in /home/dvanmosselbeen/Docs/local_svn/guicms/right_menu.inc on line 19

Warning: include() [function.include]: Failed opening 'modules/sex_commander/box_sex_commander.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/dvanmosselbeen/Docs/local_svn/guicms/right_menu.inc on line 19
 
   
Fortune msg:
Writing is turning one's worst moments into money. -- J.P. Donleavy

License:
This website refer to serveral diferents products that have his own license. So you need to look to the concerned product and not ask me about it. This website use some GPL license for some products. I think to some scripts or some apps.


Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/dvanmosselbeen/Docs/local_svn/guicms/bottom_page.php on line 81

Warning: include(http://dvm.zapto.org:3334/~dvanmosselbeen/guicms//lib/sublinks.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/dvanmosselbeen/Docs/local_svn/guicms/bottom_page.php on line 81

Warning: include() [function.include]: Failed opening 'http://dvm.zapto.org:3334/~dvanmosselbeen/guicms//lib/sublinks.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/dvanmosselbeen/Docs/local_svn/guicms/bottom_page.php on line 81

This page needed 0.70393 sec to load.
Logged as: Visitor
IP: 38.107.191.85
debian logo html 4.01 logo php logo css logo
any browser logo w3c check logo no software patent logo Firefox logo
   
   
The GUICMS is made be David Van Mosselbeen.