September 2010
Intermediate to advanced
440 pages
9h 23m
English
In its basic structure, the MySQL statement for creating tables is very similar to that for databases. Recall that database creation is involved in simply naming the database:
CREATE DATABASE foo;;
Creating a table requires the definition of at least one column. The basic syntax looks like this (note that the backticks are optional):
CREATE TABLE <table name> (`<column name>` <column specifications>);
In practice, definition of a table bar in database foo would be as follows:
CREATE TABLE bar (snafu varchar(30));
While this is basically the statement, it is also a very flawed way of defining the table when using the MySQLdb module. Before we go into what is wrong, however, let's cover what is right.
A comprehensive discussion of the ...
Read now
Unlock full access