PrintLogo

Using MCJ to Practice SQL Commands - Part 3 - Some Queries




Mountain Climbing Journal (MCJ) is a journal application that includes a SQL Tool to query the database using an embedded SQLite database engine. In Part 2 we created some records. Now, let's do some queries. Our first query will be to select all fields in all records in the journal table:

select * from journal



Select all fields in all records in the journal table that contain "the":

select * from journal where entry like '%the%'



Select one day ago:

select date('now','-1 days')



Select all fields in all records in the journal that are older than one day ago:

select * from journal where date < date('now','-1 days')



Show the table structure of the journal table using the SQLite PRAGMA command:

PRAGMA table_info(journal)


Previous | Part 1 | Part 2 | Part 3



This article comes from NetAdminTools:
http://www.netadmintools.com/

The URL for this story is:
http://www.netadmintools.com/art570.html

Copyright 1997-2008 NetAdminTools.com. Read our Terms of Use.