June 2010
Intermediate to advanced
328 pages
7h 51m
English
Although using wildcards and unnamed columns satisfies the goal of less typing, this habit creates several hazards.
Suppose you need to add a column to the Bugs table, such as date_due for scheduling purposes.
| Implicit-Columns/anti/add-column.sql | |
| | ALTER TABLE Bugs ADD COLUMN date_due DATE; |
Your INSERT statement now results in an error, because you listed eleven values instead of the twelve the table now expects.
| Implicit-Columns/anti/insert-mismatched.sql | |
| | INSERT INTO Bugs VALUES (DEFAULT, CURDATE(), 'New bug', 'Test T987 fails...', |
| | NULL, 123, NULL, NULL, DEFAULT, 'Medium', NULL); |
| | |
| | -- SQLSTATE 21S01: Column count doesn't match value count at row 1 |
In ...
Read now
Unlock full access