[Tutor] Database topic now fixed
Bob Gailer
bgailer at alum.rpi.edu
Sat May 13 21:54:56 CEST 2006
Alan Gauld wrote:
> The mistakes in my databae topic have now been rectified.
> I have no idea how I managed to post the file without testing
> that section of code. And unfortunately it's one of the areas
> where SqlLite SQL syntax varies from the Oracle syntax that
> I'm most familiar with. But that's only a partial excuse since
> my code wasn't actually valid Oracle code either, it was just
> wrong!
>
> Hopefully all errors are now removed
This is my first reading of that topic. Thank you for all the effort you
put into this, as well as your willingness to admit and fix problems. If
only Microsoft had that attitude.
Some observations:
1 - people familiar with other databases might be puzzled by the lack of
column datatypes. I'd mention that sqlite allows but does not require
types at the first introduction of CREATE TABLE,.
2 - The introduction of NULL: "NOT NULL is self explanatory, it
indicates that the value must exist and not be NULL."
To someone completely new to SQL this is IMHO not self explanatory. This
is the first appearance of "NULL" in the tutorial, and I deem a little
explanation would help. Perhaps a definition of NULL then an INSERT
statement that does not cover all columns, showing what happens when a
NULL column is omitted and then the result of a SELECT, then showing
what happens when a NOT NULL column is omitted (Error).
3 - "UNIQUE means that the value must be unique within the table. If it
is not, an error results and the row will not be inserted." This is
slightly confusing (and not totally true "unique within the table"
really is within the column).
I'd reword it something like "an insert statement that would put a value
in a unique column that is already in that column will raise an error
and not insert a row"
4 - introducing WHERE. I'd first show it as WHERE x = y and then
introduce the table prefix.
5 - following the explanation of UNIQUE under constraints, please also
explain DEFAULT.
6- the table structure in Address Book Revised looks like it is for UK
addresses. Consider saying this. Also consider a structure that would
accommodate US/Canadian address also.
7 - "SELECT First,Last, Phone FROM Address WHERE First Like Dav%;"
Shouldn't Dav% be in quotes?
HTH
More information about the Tutor
mailing list