You're asking a lot of questions, and here are a few answers. First, there aren't any reliable phonological databases that can be used to extrapolate to valid generalizations about "what human languages, by nature, do" (in case that was why you asked for a database). We don't have standardized methods of phonological analysis whereby everybody would create the same analysis when exposed to a fixed input (e.g. if every linguist listened to the Lushootseed language tapes, every linguist would come up with a different analysis). Furthermore, there is at best an informal seat of the pants method of selecting from the attested languages of the world that avoids the problem that most human languages are members of one of two language groups (Niger-Congo and Austronesian), which happen to be very similar in terms of syllable structure. Instead, we gather up whatever data we can find, and report whatever is most convenient for the position that we support. Large-scale bean-counting projects assume that the claims made in print or personal communication are correct as (mis/under)stated. This is why linguists prefer more focused study of fewer languages where we can scrutinize the details, spending years on a few languages.
You question is mainly about the concept of "sonority" in syllable structure, where the most unassailable presumption is that languages often allow words that begin with CL (consonant plus liquid) and rarely LC; and often allow ending in LC but not CL. The concept "syllable" extends the generalization to clusters in the middle of words, the main problem being that you cannot tell from pronunciation alone whether [amblik] splits the syllable between m and b, or b and l.
Sonority accounts for the bulk of sequencing generalizations across languages, but there are many facts that don't at least in any natural and obvious way fall under the penumbra of sonority. For example, a number of languages allows glide-plus vowel sylllables but disallow the specific sequences [ji, wu]. Also, the sonority generalization holds that sonority (a number) rises then falls within the syllable, meaning that a more-sonorous consonant should not precede a less-sonorous consonant in the syllable onset. And yet, more-sonorous s precedes less-sonorous t in 'stink'.
John Ohala, who hates sonority, proposed that sonority is conceptually unnecessary, and instead we should look at the concept of "perceptibility". The answer which he proposes (and I find to be correct) is that "sonority" reflects a preference for sequences where segment boundaries can easily be detected. [ji, wu] is bad because it's hard to tell where [j] ends and [i] begins; it is easier to tell where [j] ends and [a] begins. Unnatural sequences like onset [ʔt, pt] are extremely hard to parse acoustically, unlike as in the Tsou language which revels in such clusters they do something in the phonetics to make the boundaries more audible.
As for the question "how does the language determine over time what...", despite rhetoric to the contrary, languages don't have an existence independent of people that speak them. English speakers today talk the way they do because that is the rule system that they learned. The system that they learned follows naturally, more or less, from the facts of language that they are exposed to. The language facts that are their basis for learning come from learned grammars, which were themselves based on earlier data, ad infinitum.
However, learning is imperfect. In one generation, /pta/ might be conventionally pronounced with a tiny release after /p/, which later generations reinterpret as being a brief excrescent vowel, which a few generations later is further reanalysed as a full vowel, maybe [u] or [ɨ]. Or, maybe the release never happens, so you just have a moment of lip-movement at the beginning of the word (also a clear consonant when precede by a vowel in a sentence), and people just don't know that there is "supposed to be" a consonant there (as in "knight").