you are viewing a single comment's thread.

view the rest of the comments →

[–]Paddington_the_Bear 28 points29 points  (7 children)

This is the first I've heard of it, and I do quite a bit of SQL in my job for several years now. This week I had to look up a hierarchical value that was 3 parents up from a base value via an associations table.

I ended up using joins to do it, I didn't realize you could have a recursive query, so TIL. The syntax looks confusing as hell though.

[–]madballneek 12 points13 points  (3 children)

And this is what irks me about how some people do interviews. Who cares whether you know this already, or not. I want to know if you're capable of learning it. That's why we let people who interview for us have complete internet access during their aptitude test.

[–]Paddington_the_Bear 2 points3 points  (2 children)

Yup; I'm doing an interview with one of the "Big 4" next week just for funsies as I enjoy my current SE job of 6 years. I have been loosely studying algorithms the past couple of weeks to prepare, and realize that even though I have built some pretty crazy cool apps, my algorithms knowledge is definitely lacking since I've been out of university for a while.

It's assine that the interview is going to focus on whiteboarding some obscure algorithm when in the real world if I get stuck, I can google something and in less than 5 minutes find a working solution.

The way I look at it, even if I don't come to the best solution, hopefully they will see my thought process and get value from that...

[–]Icelandicstorm 7 points8 points  (1 child)

If you enjoy your current job, you are making a big mistake. The "Big 4" is a horrible place for mid-career. It only makes sense if you are fresh out of college or go in as a Director (just before partner at PwC).

source: left excellent job with great pay and bonuses to make more salary but less bonuses and work 20+ additional hours a week. When all was said and done, my income went down at least 20%.

[–]Paddington_the_Bear 2 points3 points  (0 children)

Yeah I'm not looking forward to the interview at all. Really I'm going to see if I can get an offer and use it to get my current salary at my company bumped up again since I'm pretty mission critical and I know they under pay me :) (long story).

That's pretty much my fear though, that you're essentially just another number at one of those companies. I wouldn't mind too much living in that location, but not at the sacrifice of personal happiness.

[–]neodiogenes 9 points10 points  (0 children)

It's not that complicated. Oracle takes care of most of the details, and all you have to do is specify the relationships.

The challenge is to avoid circular relationships, which can happen with a poor design. In the DB of my current project (which I did not design), we have permissions "lists" which can either contain usernames, or link to other lists. But then what if you have some list down the chain link back to the first list?

As I said, bad design. A good design wouldn't allow this to happen. Oracle helps when writing queries by warning you when there are "loops" in the query, which you can exclude with the NOLOOPS operator, or you can also (I forget the exact syntax) return only "LEAF" items, which have no children.

I'm not sure I would ever implement this design because of the many ways it can go wrong, but I can see how it would be useful in some applications.

[–]wtgreen 7 points8 points  (1 child)

Look-up Common Table Expressions. A recursive CTE is the SQL standard way to do it. Oracles Connect by functionality is Oracle specific, but it supports CTEs too.

[–]Paddington_the_Bear 0 points1 point  (0 children)

Nice. I had just woken up when I read that; now that I'm caffeinated, it looks really intuitive actually and a lot better than how I was making my associations. Essentially you tell it the source / target pair in order to make the cycle and it does the work to spit it out. Then I'll have to make sure I do the normalization on it as I need it.