MySQL vs. SQLite

Bild von Sven

Ich mag MySQL und ich mag SQLite, jedes hat für gewissen Anwendungsgebiete seine Vorteile. Nein, kommt mir nicht mit Postgres, ich bin kein Datenbankler und schreibe allerhöchstens datenverarbeitende Programme, keine Datenbankprogramme ;-)

Das schöne an SQLite ist einfach die Tatsache, dass man z.B. auf'm Laptop keinen DB-Server (oder wie auch immer ihr den mysqld bezeichnen wollt ;-) laufen lassen muss. Einfach ein Flat File, direkt drauf und SQL-Querys absetzen. Zum Spielen und Testen definitv ziemlich smart.

Aber das hier stößt mir dann doch auf:

svelt@babe:~> sqlite3 new.db
SQLite version 3.3.7
Enter ".help" for instructions
sqlite> create table date_test ( datum datetime );
sqlite> insert into date_test values ('2006-08-31 9:0:0');
sqlite> insert into date_test values ('2006-08-31 11:0:0');
sqlite> insert into date_test values ('2006-08-31 11:00:00');
sqlite> insert into date_test values ('2006-08-31 09:0:00');
sqlite> insert into date_test values ('2006-08-31 09:00:00');
sqlite> select * from date_test order by datum;
2006-08-31 09:00:00
2006-08-31 09:0:00
2006-08-31 11:00:00
2006-08-31 11:0:0
2006-08-31 9:0:0

Welcher Idiot unterscheidet bitte "9:0:0 Uhr" von "09:00:00 Uhr"? Natürlich ging ich erstmal davon aus, dass mein Programm was flasch macht, aber nein, SQLite war's. Scheiße! Und nein, ich hab bisher nicht nachgesehen, ob das dokumentiert ist. Selbst wenn es das wäre, ist es ein Bug und kein Feature. Myll!

Ach ja, das macht nebenbei MySQL draus (CREATE & INSERTS per copy&paste an MySQL):


mysql> select * from date_test order by datum;
+---------------------+
| datum |
+---------------------+
| 2006-08-31 09:00:00 |
| 2006-08-31 09:00:00 |
| 2006-08-31 09:00:00 |
| 2006-08-31 11:00:00 |
| 2006-08-31 11:00:00 |
+---------------------+

So sollte das auch aussehen. *Seufz* Doch wieder full blown MySQL-Server auf den Laptop? Hmmm... :-/

Trackback URL for this post:

http://www.velt.de/trackback/105

Datatypes In SQLite Version 2

SQLite is "typeless". This means that you can store any kind of data you want in any column of any table, regardless of the declared datatype of that column. (See the one exception to this rule in section 2.0 below.) This behavior is a feature, not a bug. A database is suppose to store and retrieve data and it should not matter to the database what format that data is in. The strong typing system found in most other SQL engines and codified in the SQL language spec is a misfeature - it is an example of the implementation showing through into the interface. SQLite seeks to overcome this misfeature by allowing you to store any kind of data into any kind of column and by allowing flexibility in the specification of datatypes.
Link: Datatypes In SQLite Version 2

Bild von Sven

"Datatypes" in SQLite

Eigentlich wollte ich hier einen Kommentar reinpacken... wurde dann aber zu lange und daher als extra Blogeintrag: "Datatypes" in SQLite

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.
  • You may link to Gallery2 items on this site using a special syntax.

Weitere Informationen über Formatierungsoptionen

To combat spam, please enter the code in the image.
Inhalt abgleichen
Powered by Olark