DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

MySQL Tips

  • submit to reddit
// find the average time given a column of time values
sec_to_time( avg( time_to_sec( timecolname )))

// insert from non-relational tables
INSERT INTO yourtable VALUES ((SELECT userid FROM users WHERE username='Kenny'),(SELECT foodid FROM food WHERE food='apple'))