In the city you also have the option of finding a property zoned Multi-family. The density in the area is likely to be pretty high. I haven’t made a thorough survey of where they all are, but I know some still aren’t completely built out.
I am currently building what the County of San Diego calls a “secondary dwelling unit”. Either my main house or the smaller one can be rented as long as the owner lives in one of them. I had to record a statement saying that I would comply and it applies to future owners. It can be up to 30% of the size of the “primary dwelling” or 50% with an expensive and certain to be problematic variance process. The maximum under any situation is 1200 sqft. My lot is big, so the ground water restrictions had the potential to be most limiting factor.
Properties where this can be done are in the rural and semi-rural areas that fall under County of San Diego administrative authority.
In case anyone doesn’t already know, second houses , even legal rentals, don’t normally increase equity much so this probably shouldn’t be a motivating factor to build one. It could easily end up being a break even project, or worse.