- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Sounds a lot like the typical "holiday" table around here...
Happy Holidays to all !!!
Admin
Not the first time Donnie was left alone at a table due to a date!
Admin
@ParkinT
Dude.... that was awful....
Admin
Actually if you've taken a masters' level class in relational design, you'd know this is how you're supposed to do it.
Sure, in a programming language you'd have a library function to convert the internal date to various display formats. But while some rudimentary functions may be available, database systems are really all about data and that's where the best optimizations are. Besides, you still haven't solved the problem of identifying holidays.
TRWTF(tm) is that the original developer didn't populate the table with 1000 years of data. I mean, the cost of a TB of disk space is less than even one support call to update the darn thing!
Admin
Also, he put another quarter into the machine.
Admin
"Relational Design", certainly not, at least if you identify proper relational design with third normal form and above as I do - but that's classic "Dimensional Design", which is Kimball's voluntarily departure from normalization.
Whether dimensional design is a gigantic WTF is another debate ...
Captcha: Nulla. Would make Chris Date blow another fuse ...
Admin
Don't forget to include a column in the date table for every possible display format. Hey, you could use the format string as the column name!
And then you need an index on every column, so you can quickly look up user entered dates and convert them to internal format! But you knew that already, right?
Admin
Admin
Admin
One comedy troll is amusing. Many comedy trolls are tedious.
Admin
I see no problem with this as long as you are talking about some sort of data warehousing system where you may need or want a date dimension. It very much depends on the context of the system. If you told me this was OLTP I would probably have issue with it. OLAP on the other hand I wouldn't consider it a problem at first glance.
Admin
(You may think I'm joking, but I worked for the VP of IS in a major retail chain, and he actually did this in a lot of his tables. Sometimes he even had subdelimited values within his delimited values. And the lusers thought he was a genious. Hence the promotion to VP. True story...)
Admin
I feel sorry for the few beginner programmers that stumble upon these forums and just might take these trolls seriously.
Admin
Trolls? Where?.. All I see are ppl poking fun at an epic WTF if this database is used in an ordinary application, and a 'maybe somewhat WTFfy' when looking at a data warehouse.
I think the term Troll is coming up too much on these boards lately...
Admin
You mean like under the seats of 194 Chem at UC Davis?
blink
Actually, I don't know if 194 Chem is even used anymore; haven't seen it since the late '70s. But I distinctly remember the sensation of being surrounded by regiments of lower forms of life...
CAPTCHA: Venio. Also vidio and vicio.
Admin
Admin
Admin
How about that: Don't use the DBS for data formatting. Just fetch the data or a query and let the library functions of your favourite programming language to the rest. For the holidays add an additional table where only those are stored and perform a join on that. And some holidays don't even need some table to be stored in, as they can be derived algorithmically (Gauß invented a lot of algorithms for that).
Admin
[quote user="CaRL"][quote user="TrueGenious"](You may think I'm joking, but I worked for the VP of IS in a major retail chain, and he actually did this in a lot of his tables. Sometimes he even had subdelimited values within his delimited values. And the lusers thought he was a genious. Hence the promotion to VP. True story...)[/quote]
I've used delimited data inside a field before. Of course I was young and stupid; nowadays I'd use a separate table to store arbitrary numbers of elements associated with a key.
At least I learn from my mistakes; it's the people who don't that make me cry.
Admin
Admin
If you live in the western half of the US, and own a certain common household object, you've probably shopped there. And wondered why they were out of stock of an obviously popular item.
Admin
I swear, 99% of TheDailyWTF commenters wouldn't spot a troll if it was bullying billy goats from under a bridge... >_<
Admin
Eh...if you come to a website that's explicitly about perversions in IT, and take anything posted on it to be good real-world advice, you deserve what you get.
Admin
Admin
This is a "calendar table." It's usually used when you need to know what dates are holidays. It can be further extended to mark what fiscal years dates fit into, whether a holiday is for Muslems, or any other attribute of a specific day in the universe of all dates. And yes, it has to be periodically added to, especially since those attributes can be different for future dates.
This is only a WTF if none of those needs exist.
Admin
so for first names and last names ? really? two tables? and then if they keep track of middle names? really? three tables for a list of employee names? and then they have phone numbers? really? the employee phonelist requires 4 tables?
Admin
If there's any justice in the world, the trolls will someday be charged with maintaining the code that said beginner programmers produce...
Admin
If you've gone so far as gotten a job with that master's level class (singular), You'd know that theory and practice are two separate things.
If you took that masters class at a good school (like MIT or CMU) you'd know that there is no supposed way of doing anything.
If you took more than the first master's class in 'database management for non-technical users' and had started with the undergraduate "relational algrebra" class, you would know that the natural key (attribute) would allow for all tuples access to simpler set operations without creating an alternate serogate key.
Admin
Q.E.D.
Admin
Regarding delimited data: The ASCII standard actually provides a few little-used characters for this purpose, 1C (FS: File Separator), 1D (GS: Group Separator), 1E (RS: Record Separator), and 1F (US: Unit Separator). I've actually used them sometimes for data delimiting in storage and transfer formats, but few others seem to know of them.
Admin
Admin
Looking at the other tables shown in the schema, this is clearly transactional. Had this really been an OLAP db, this would absolutely be necessary. as far as I know, there is no other way to include a date dimension without a date table. SSAS, for example doesn't even offer a date type.
(TRWTF is appending/prepending object names with it's type)
Admin
Being a recent student of UC Davis I can verify that Chem 194 still exists, and still has an awesome underground tunnel to the Chemistry department
http://daviswiki.org/Chem_194
Admin
No kiding! I'd have aready finished my first LISP program, if it didn't take that long to define the 'increment function for up to 2147483647, and then '+, '-, '* and '/, as lambda calculus told me to. (A related problem is that 'decrement is way too slow, but I can spare a cluster...)
Anyway, don't tell anybody, but people say that some holidays are fixed in the solar calendar, while the others are fixed in the lunar calendar.
Admin
Admin
Well, if we can't recognise, not one, but two excellent and relevant database puns whilst quoting a captcha, what can we recognise?
Oh look, egg-nog...
Admin
Admin
Admin
So is it wrong of me to assign the beginner code maintenance to other beginners?
Admin
I actually run an accounting system that has to have it's period dates added manually. We ran into this problem a few years ago, when the guy who maintained that chunk of the system retired without mentioning that little factoid. When the table ran out of dates, it deferred it's billing to the farthest forward date it could calculate (I think it was 2025 or something).
I thought of trying to automate it, but we run a 5-4-4 billing cycle and the dates are decided arbitrarily by finance, so that's pretty impossible.
Admin
The real WTF is that dates_tb.IsHoliday isn't named DateIsHoliday.
Admin
Actually, one isn't really all that amusing.
Admin
@Satanicpussy
Probably 2038, the maximum date (03:14:07 UTC at Tuesday 19th January 2038 to be exact), because that's the maximum number of seconds from 1/1/1970 that can be stored in a 32bit signed int ;)
Admin
Sure. For use back in the 1970's and 1980's. You know, when there weren't really anything other than mainframes and 8088's?
However, time has moved on. We're almost 40 years beyond 1970 now.
I used them sometimes, too, back when I was doing C and .ASM code for DOS. They've since invented databases that hold tables, and those tables actually can hold multiple columns. For things where databases are overkill, they have something called XML that works reasonably well.
The reason that few others seem to know of them is because they haven't been commonly used in decades. Perhaps you need a refresher course in the current state of technology and data storage? ;-)
Admin
Finally, the first useful post! I'm printing this one out and taping it to the wall so I don't for.....wait a minute. I see what you did there. Dang.
Admin
So why not just store a date in the dateId fields of all these tables, and then make the date the primary key of the calendar table?
This makes the specific relation unnecessary (you can always join to get the holiday, but this is unecessary for at least some of that code), shrinking the size of your DB and making inserts/updates/deletes quicker, and allows you to insert dates at any time without crashing the code, and then allowing you to add rows to the Holidays table after the fact.
Admin
DateDate
hmmmm, thank goodness for that row, otherwise it would really be confusion.
Admin
You're right; that's the way it would actually be done. There are some database practitioners that don't believe in using real-world keys, and would always use an artificial "surrogate" key, but I'm not one of them.
Admin
Some of us come for the good examples of bad examples:P
Admin
ASCII also has such terrifically under used codes as <BELL> to ring the bell on the teletype, <LF> to return the print head carriage back to the beginning of the line, and cool and useful winners like <VT> vertical tab.
But really, is it not best to simply serialize objects into xml and store them in the DB? Heck with Xpath and XQuery, I can intermix SQL and and XML for the ultimate in ease of use and maintainability!
(ok..sarcasm, yes. Troll no.)