Nothing like a good o'le Friday Smorgasbord exploring how some programmers manage to abuse databases ...
A couple months back, we got a chance to see a fantastic "Database-Driven" website that Miki Watts was lucky enough to inherit. Here's another peek into it, showing just how fantastically dynamic it is. Just incase you ever want to have 10000MB have a size of 9847, a disk size of of 3200 and displayed inbetween 50 and 30000 ...
| disk_options |
| SKU |
SizeDesc |
Size |
Meas |
DiskSize |
SortOrd |
Active |
| D000050 |
50 MB |
50 |
MB |
50 |
1 |
0 |
| D000050 |
50 MB |
50 |
MB |
50 |
1 |
1 |
| D000100 |
100 MB |
100 |
MB |
100 |
2 |
1 |
| D001000 |
1000 MB |
1000 |
MB |
1000 |
3 |
1 |
| D005000 |
5000 MB |
5000 |
MB |
5000 |
4 |
1 |
| D010000 |
10000 MB |
10000 |
MB |
10000 |
5 |
1 |
| D020000 |
30000 MB |
30000 |
MB |
30000 |
6 |
1 |
| D030000 |
50000 MB |
50000 |
MB |
50000 |
7 |
1 |
Up next, David Graham was a bit dissapointed to learn that the developers at his work have a hard time understanding nothing. The first row in every table ...
| caller_id |
owner_id |
description |
... |
| -1 |
NULL |
'Not Used' |
... |
Jakob Christensen was surprised to find a Y2K bug in 2001. Of course, it wasn't the typical Y2K bug, it was a bug that only worked in the year 2000 ...
--calculate age based from 'ddmmyy' birthdate
SET @Age =
SELECT (100-(ROUND(@BirthDate/1,0,1)*1-100 *
ROUND(@BirthDate/100,0,1))/1)
And Finally, W.F. discovered a rather odd database implementation of a business rule: A standard order has a maximum discount of 15% and can be canceled prior to shipping. A custom order has a maxium discount of 50% and cannot be canceled.
| order_types |
| code |
name |
is_standard |
is_custom |
can_cancel |
max_disc |
| STND |
Standard Order |
1 |
0 |
1 |
15 |
| CUST |
Custom Order |
0 |
1 |
0 |
50 |