Relative Content

Tag Archive for sqldatabaserelational

How to fix a bad design for a relational database?

I’m curious about what the steps would be to fixing a relatively large database (100 to 500 tables). If for example, it’s a train wreck of a database with hardly any foreign keys, redundant data, and fails just about every normalization form. What would you do? Start from the ground up, or fix it as you go through it (If at all possible, I’m not sure about those steps either)? Thank you so much, all input is appreciated.

SQL query Limit based

I was solving SQL based question on leetcode – https://leetcode.com/problems/nth-highest-salary/submissions/1259886791/ (nth largest income) and another was – https://leetcode.com/problems/second-highest-salary/ (2nd highest income) so i was looking at the solution of 1st problem (nth largest income) and for any greater number for which the answer can’t be given it generated null as output where as in 2nd problem (2nd largest income) here limit is not useful because it’s not generating null for any invalid input or input greater than number of tuples in table but why is this happening.
I am also providing the solution i found from leetcode and please do try to explain me as I am new in SQL.