There is a community aspect to this that can be lost if we just think of questions as being things that fit into buckets (sites). A user might choose to ask a question on the "general" site instead of the specialized one because the person is part of the community on the "general" site. It's pretty frustrating (speaking from experience) when your question that is on-topic here gets migrated away to someplace else where you're not. So even if there is a "better" place for a question based on site scopes, if it's on-topic where it was asked it should be left alone. It's fine to let the author know about the other site, particularly if it's a new user who isn't invested in either, but we should let the person with the question decide where to ask it (among on-topic options).
Yes, that means some SQL questions will be on the programming site and some will be on the databases site. We should look for ways to make cross-site related questions/tags visible on both ends. We might even think in terms of showing siteA:tagX questions on siteB where tagX is also interesting. This is an idea for future consideration, not a baked proposal.
If a question is on-topic on more than one site and is tuned for each site, I don't have a problem with it being asked on both sites. An author who does this should link the questions together so everybody who finds one part of it also finds a trail to the other parts.
For now I think of overlap and cross-site duplicates or partial duplicates as a human issue, not a technical one. Migration on SE never worked well from either the human or technical perspective; let's figure out how to do better.