Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 
avatar of xQbert

xQbert

xQbert has asked 4 questions and find answers to 58 problems.

Stats

1.3k
EtPoint
398
Vote count
4
questions
58
answers

About

STEPS to Resolve a problem:

  1. Do something, anything along the vein of solving the problem that gets you to a resolution
  2. Review it and laugh (laughing is critical to alleviate the stress of solving the problem.)
  3. Now do something right. Take ideas from the first attempt and use them to evolve a cleaner often simpler solution.
  4. Now make it better. Find inaccuracies; inefficiencies; or holes in the cleaner solution and develop a more robust, simpler and more accurate solution. Time doesn't always allow for step 4; but when it does it makes maintenance and future errors easier and less frequent.

I am: (No this isn't a Lotus Notes R5 commerical)

  • SQL enthusiast
  • Logical problem solver
  • Data Miner
  • SQL is like golf. You only have yourself to blame when you don't achieve the desired results.

If you're new to SQL: I find the venn diagram approach very useful. It's by no means 100% accurate. Relationships and set based are similar; but not the same. See Say no to venn diagrams when explaining joins as to why.

For those needing to ask a question consider talking to the duck first. Yes, I'm serious.

To generate a nice table data for question

For those proffering a solution be sure to Test it or perhaps Demo the Question!

Now, to inject some humor:

[SELECT userID
FROM  users
WHERE Name = 'Robert');Drop table students;
--Little bobby tables we call him.]

(http://xkcd.com/327/)

I (not so recently) found an exchange in comments humorous:

  • If you EVER need to do math on it, store it as a number
  • If you'll NEVER do math on it store it as string
  • If it needs to do both, you need two columns
  • Except for dates... store dates as dates period and use date functions on them... not string {shudder} functions!
  • and AutoIncrements can be numbers (though we should never do math on them)

@xQbert -- this shall henceforth be referred to as "xQbert's razor"

And because I'm lazy you may see this in several of my comments to help new members:

SO is a great site to ask GOOD questions and get answers: Just be sure to provide a complete MCVE. Before you ask a question consider talking to the duck first. Yes, I'm serious! To help us help you, generate sample data and expected results. ascii table makes the output easy to read! You could also mock up data and the SQL tried using http://dbfiddle.uk or a similar site.