Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
 
Which database should I use? MySQL v SQLite

Which SQL Database would I advise newcomers with a new application to use?

Five years ago, MySQL would have been the obvious choice in many circumstances. But these days, MySQL has grown into a much bigger product and there are very serious licensing and other commercial issues that need to be considered; whilst it remains open source, it's a very long way from having a license that's close to public domain.

The answer these days may, still, be MySQL. Or it may be PostgreSQL. Or it may be SQLite. But the answer will certainly include a caveat to warn the newcomer to write his SQL in such a way that it's not impossible to change at a future date. A wrapper - a set of functions that hides the actual database - is a good idea. And that may be quite thin, or it may include lots of extra facilities. Such a wrapper is included, for example, in your model classes in Ruby on Rails via Active Records and a host of other methods and facilities.

Reduced to SQL commands, SQL doesn't vary as much as you would expect; the admin, logging in, and control of multiple appications differs but the actual tables and table commands are remarkably similar ... with SQLite typically offering the most restricted set. It's therefore a logical approach to code for SQLite if it provides everything you need, in the knowledge that you can move on to MySQL or PostgreSQL or something else later.

By way of example, I wrote a series of SQL commands in MySQL earlier today, and then sourced them though the mysql client program. I then edited that series of commands to see how much needed changing for SQLite to be sourced through the sqlite client program. The answer was "not very much". Apart from the removal of the database stuff (and replacing database level flushes with table level flushes), the only thing that caused an issue was a right join ... and that could easily be rewritten as a left join.

The SQLite file is [here] and the MySQL file I started with is [here].

And here is the full difference report:

trainee@brugges:~/ruby$ diff seeds.mysql seeds.sqlite
1,4c1,3
< #%% MySQL example - table joins
< drop database if exists jamie;
< create database jamie;
< use jamie;
---
> #%% SQLite example - table joins
> drop table aisles;
> drop table products;
26d24
< select * from aisles right join products on aisles.aid = products.aid;


(written 2013-02-16)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
S152 - SQL Primer as Used in MySQL
  [3061] Databases - why data is split into separate tables, and how to join them - (2010-11-20)
  [3060] INSERT, DELETE, REPLACE and UPDATE - changing the content of SQL tables - (2010-11-19)
  [2240] How do I query a database (MySQL)? - (2009-06-15)
  [591] Key facts - SQL and MySQL - (2006-02-04)
  [515] MySQL - an FAQ - (2005-12-03)
  [502] SELECT in MySQL - choosing the rows you want - (2005-11-22)
  [494] MySQL - a score of things to remember - (2005-11-12)
  [270] NULL in MySQL - (2005-04-06)
  [158] MySQL - LEFT JOIN and RIGHT JOIN, INNER JOIN and OUTER JOIN - (2004-12-20)

S200 - MySQL - SQLite
  [4024] SQL databases from Python - an SQLite example - (2013-03-02)
  [4006] Ruby / SQLite3 example program, showing JOIN v LEFT JOIN - (2013-02-16)
  [3269] Files or Databases? MySQL, SQLite, or Oracle? - (2011-04-28)
  [3139] Steering our Python courses towards wxPython, SQLite and Django - (2011-01-19)
  [3099] Perl - database access - DBD, DBI and DBIx modules - (2010-12-22)
  [2786] Factory methods and SqLite in use in a Python teaching example - (2010-05-29)
  [2746] Model - View - Controller demo, Sqlite - Python 3 - Qt4 - (2010-04-29)
  [2745] Connecting Python to sqlite and MySQL databases - (2010-04-28)
  [2744] PyQt (Python and Qt) and wxPython - GUI comparison - (2010-04-28)
  [2561] The future of MySQL - (2010-01-03)


Back to
Ruby / SQLite3 example program, showing JOIN v LEFT JOIN
Previous and next
or
Horse's mouth home
Forward to
Reading and checking user inputs - first lessons - Ruby
Some other Articles
From Salford
Really Simple Rails
Clear, concise examples - Ruby classes and objects.
Reading and checking user inputs - first lessons - Ruby
Which database should I use? MySQL v SQLite
New guest ... becoming returning guest
Annual Accounts - a big job for a small business
Web and console - same principle, same code - Ruby example
Images of Melksham you havent seen before
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2019: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/4007_Whi ... QLite.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat