Jump to content

Mark1inLA

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by Mark1inLA

  1. I believe this will do the trick: You can load the dump file back into the server like this: shell> mysql db_name < backup-file.sql taken from: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html And, would I use something like PuTTY to put that command into? Where would I put that command? PuTTY has me a bit confused . Thanks! Qadoshyah yes, if its a linux box, you putty into it. This link should help after you login: http://dev.mysql.com/doc/refman/5.0/en/mysql.html
  2. I believe this will do the trick: You can load the dump file back into the server like this: shell> mysql db_name < backup-file.sql taken from: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
  3. Problem solved! Thanks a bunch for your help and detailed comments.
  4. That's not descending order... I'm not exactly sure about descending or ascending orders for dates, so let me restate: from the most recent anniversary dates to the later.
  5. Hi all, I've been trying to figure this out for quite sometime and haven't been able to resolve it yet. Here is some sample data: id name hire_date 1 john 2005-01-10 2 jane 2009-12-10 3 bill 2007-11-10 How can i get it to sort from the most recent anniversary date in descending order so that the order will show in this order: John, Jane, Bill Thanks in advance!
  6. Thanks for your response. In my situation, this worked. But in the MySQL certification study guide, i found some more info on the subject:
  7. Hello all, I added a composite key to a table that's lacking a primary key. Now i have an automated PHP script that utilizes the multi-insert query to populate this table on a daily basis. The issue I'm having is that when there's a duplicate value, i want to be able to add the ones that it can but ignore the ones that already exist. Is there a way to get this result using PHP/MySQL?
  8. hello all, i'm not sure what category this falls under so i put it here. I have a cron job running around midnight that generates a text file of the previous days orders. The file for yesterday was 70k bytes. Now this morning when the file was downloaded and imported into another system, it was discovered that the import file had missing orders and it was only 40k bytes. I thought downloading a file like this was an all or nothing type of thing, so i have no idea why this could happen (unless the user explicitily deleted the bottom portion of the file, but not likely). Is it possible that the file partially downloaded and was processed as-is? and if so, how can i prevent that from happening?
  9. Mixing PHP and HTML makes the code very hard to read
  10. Thanks for the explanation and heads-up. i thought the date_format function did a behind-the-scene conversion so that the query will be optimized. I guess that's not the case..
  11. I understand that if you want to query from a daterange, this will work: select * from mytable where datecol >= '2009-01-01' AND datecol <= '2009-09-22' But when i use this query, it ignores the year and returns records that match the month and day: select * from mytable where DATE_FORMAT(datecol, '%m-%d-%Y') >= '01-01-2009' AND DATE_FORMAT(datecol, '%m-%d-%Y') <= '09-22-2009' Anyone know the reason and can explain what's going on? Instead of dwelling too deep why, I ended up rewriting the query to use BETWEEN operator, but i just found this odd.
  12. Yes, you can run that in phpmyadmin, but you'll have to construct the sql statement. Regarding your other questions, yes it's very important to understand why separating tables is critical, not only for performance, but diskspace as well. Here's a good article that'll explain how/why. It should also give an example of joins at the end of it.
  13. I'd use outer joins to connect the 2ndary tables (assuming general_information is primary and interests & pictures are optional). so you can use something like this: SELECT * FROM customers LEFT JOIN interests ON customers.id = interests.customer_id LEFT JOIN pictures ON customers.id = pictures.customer_id Hope this helps!
  14. In this situation, you have 2 entities photos and people where they'd each have an id like this: photos: id int name varchar people: id int name varchar You can add an intermediate table that associates these tables. Both ID's from each table would be the primary key: PhotosPeoples: photo_id int people_id int This way multiple photos can have multiple people. Just an FYI, storing image path names instead of the images themselves and using comma delimited columns are anti-patterns.
  15. Ahh, its probably because you need to use identifiers for the other columns like Temp.id as `temp.id`. I shouldve noticed that before submitting it.
  16. SELECT General.id, General.url, General.title, General.description, Temp.id, Temp.url, Temp.title, Temp.description, Location.id, Location.url, Location.title, Location.description FROM General INNER JOIN Temp ON General.id = Temp.id INNER JOIN Location ON Temp.id = Location.id ORDER BY General.title Will this work?
  17. Just an FYI from my experience, the id wouldn't be necessary for this table. The index can be (user_id, friend_id).
  18. Here's one way: http://framework.zend.com/manual/en/zend.db.profiler.html
  19. Like other people mentioned, an intermediate table between users & friends should solve your problem. The anti-pattern sticky thread has a very good explanation of this along with a bunch other helpful 'did you knows'.
  20. I'll take first crack at it. based on these assumptions: freebie.status represents whether or not the freebie is available freebie_customer.status is the customer's decision of whether they accept or not a record will only exist in freebie_customer if it's been decided here's the query i came with: SELECT freebie.freebie_id, freebie.title, freebie.filename, freebie.description, freebie.status, freebie.from_date, freebie.to_date, freebie.created_time, freebie.update_time FROM freebie LEFT JOIN freebie_customer ON freebie.freebie_id = freebie_customer.id WHERE freebie_customer.id IS NULL AND freebie.from_date >= [start_date] AND freebie.to_date <= [end_date] AND freebie.status = [available] AND freebie_customer.customer_id = [customer_id]
  21. I agree with you. Denormalization goes against the philosophy of putting integrity in equal footing with performance. 1 particular article brings up some valid points that support this practice, but I still have a tough time grasping this as a viable long-term solution.
  22. Hello all, I wanted to get your thoughts on denormalization. In 1 hand you have a performance boost by not having to use joins and the other you have data integrity and no redundancy. Are there special circumstances where you would sacrifice integrity over performance? Have you had any experiences denormalizing and do you have any strong opinions either way?
  23. I should've tested this on some sample tables before posting. It turns out the records that had values were not part of the join (which explains why the values weren't showing up in the join but did show up when i removed it).
  24. I'm not sure if this is possible in MySQL alone... the way I'd approach this problem is by creating a recursive function in PHP that checks to see: A. if the message is a top level category. B. if there are children to that category. Just recently, I read about this very subject in a book that shows how to handle this situation. When i get home and if this problem is unresolved, ill share the example.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.