|
Until you sign up you can't do much. Yes, it's free.
|
|
|
|
|
|
|
 | / / / Viewing Topic
|  |
( pleaseremove )
meh
Patron
Tech Support Leader
|
OK, I was going to post a question, but given I have solved it there is little need. What however I thought I would post was a quick snippet to show people how powerful even a basic engine like MySQL really is. | Code: | SELECT CONCAT('http://someurl/', reviews.id) AS link, filmdb.Film AS title, DATE_FORMAT(STR_TO_DATE(CONCAT(reviews.day, ',', reviews.month, ',', reviews.year), '%d,%m,%Y'), '%a, %d %b %Y %H:%i:%S +0000') AS date, CONCAT(reviews.writ, ' reviews ', filmdb.Film) AS description FROM reviews JOIN filmdb ON filmdb.id = reviews.id ORDER BY `reviews`.`id` DESC LIMIT 0 , 15 | Here this is generating each of the items needed for an RSS feed. In this case, because of old poor design of the database the date is stored in 3 fields, day, month and year. This code actually converts them into a correctly formatted datetime for RSS. People forget you can do casting, string manipulation and conversions etc all in SQL. it makes for often much nicer and faster systems if you get it right. After all, SQL as it exists in MSSQL and DB2 etc are Turing complete and fully featured programming languages. Post edited at 6:29 am on May 29, 2009 by pleaseremove
------- Anyone who isn't confused really doesn't understand the situation http://craigk.org/pictures/ Can you work out the code?
|
|
|
|
|
 LiveWire Humor
|
|
Sector Corrupt
Guru
Patron
Tech Support Leader
|
Yeah, they're fully featured, It's just more difficult to get the hang of them. Most people don't get into doing databases until they've already got a fair amount of programming experience, and It's a completely different paradigm from what people are used to. Declarative is trickier, or at least looks it to me. I've yet to use SQL though I'll probably be adding a Database to one of my programs so I'll need it then.
------- Livewire Wifey: Katie :D Windows, For when you don't know any better. Mac, for when you think you do. Linux, for when you actually want to get something done.
|
|
|
matto
Omnipotent One
Patron
Tech Support Leader
|
SQL has been very interesting and useful in my limited use of it. Cool example!
------- "Say what you like about the tenets of National Socialism, Dude, at least it's an ethos." --Walter Sobchak
|
2:25 pm on May 30, 2009 | Joined: Aug. 2007 | Days Active: 490 Join to learn more about matto California, United States | Male | Posts: 9,804 | Points: 19,066
|
|
| |
|
|
Spiker19
Dairy Product Addict
|
I hate SQL, solely because the tutor who taught us it in university was completely useless and didnt exactly TEACH us it. They simply gave us a big long confusing coursework to do and we basically had to learn the SQL and Coldfusion code ourselves. Something went wrong with my SQL where it just output every record over and over and he didnt even help fix it. Just told me what it was called. Pfft
------- Only the cool kids snort smarties...
|
|
|
|
|
|
| Looking for something else?
|
|
|
|
|
|
 | / / / Viewing Topic |  |
|