On 3/19/08, Derek Developer <[EMAIL PROTECTED]> wrote: > > (2nd attempt... bounced back for some reason...) > > In testing a my code I came across this example. > Could someone help me understand what this syntax is doing please > (from the Seinfeld demo database examples) > > ...m col > ...h on > ...w 20 17 6 23 6 > ...e on > > Is this some form of typecasting?
All of the above commands are abbreviations of a dot command in the sqlite3 shell tool. Please see the list below to figure out which is which... sqlite> .help .bail ON|OFF Stop after hitting an error. Default OFF .databases List names and files of attached databases .dump ?TABLE? ... Dump the database in an SQL text format .echo ON|OFF Turn command echo on or off .exit Exit this program .explain ON|OFF Turn output mode suitable for EXPLAIN on or off. .header(s) ON|OFF Turn display of headers on or off .help Show this message .import FILE TABLE Import data from FILE into TABLE .indices TABLE Show names of all indices on TABLE .load FILE ?ENTRY? Load an extension library .mode MODE ?TABLE? Set output mode where MODE is one of: csv Comma-separated values column Left-aligned columns. (See .width) html HTML <table> code insert SQL insert statements for TABLE line One value per line list Values delimited by .separator string tabs Tab-separated values tcl TCL list elements .nullvalue STRING Print STRING in place of NULL values .output FILENAME Send output to FILENAME .output stdout Send output to the screen .prompt MAIN CONTINUE Replace the standard prompts .quit Exit this program .read FILENAME Execute SQL in FILENAME .schema ?TABLE? Show the CREATE statements .separator STRING Change separator used by output mode and .import .show Show the current values for various settings .tables ?PATTERN? List names of tables matching a LIKE pattern .timeout MS Try opening locked tables for MS milliseconds .timer ON|OFF Turn the CPU timer measurement on or off .width NUM NUM ... Set column widths for "column" mode sqlite> > This is how they are used > > > SELECT f.name as food, e1.name, e1.season, e2.name, e2.season > FROM episodes e1, foods_episodes fe1, foods f, > episodes e2, foods_episodes fe2 > WHERE > -- Get foods in season 4 > (e1.id = fe1.episode_id AND e1.season = 4) AND fe1.food_id = f.id > -- Link foods with all other epsisodes > AND (fe1.food_id = fe2.food_id) > -- Link with their respective episodes and filter out e1's season > AND (fe2.episode_id = e2.id AND e2.season != e1.season) > ORDER BY f.name; > > SELECT e.name AS Episode, COUNT(f.id) AS Foods > FROM foods f > JOIN foods_episodes fe on f.id=fe.food_id > JOIN episodes e on fe.episode_id=e.id > GROUP BY e.id > ORDER BY Foods DESC > LIMIT 10; > > SELECT 1 IN (1,2,3); > SELECT 2 IN (3,4,5); > SELECT COUNT(*) FROM foods WHERE type_id IN (1,2); > SELECT COUNT(*) FROM foods WHERE type_id > IN (SELECT id FROM food_types WHERE name='Bakery' OR name='Cereal'); > > SELECT name, > (SELECT COUNT(id) FROM foods_episodes WHERE food_id=f.id) count > FROM foods f ORDER BY count DESC LIMIT 10; > > > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users