I have a database, which holds many first names, occurring like the following pattern:
The name can consist of many first names (like double, or triple names), separated by either a '-' or a ' '. Each of the names consists of either lowercase or UPPERCASE letters or a capital first letter and the rest lowercase.
I would like to write a query to count all names which have either just UPPERCASE letters, or do not have a capital letter after a break of two words.
Sample Table and Data
CREATE TABLE names( name VARCHAR, PRIMARY KEY(name) );
INSERT INTO names values('Veronika isabella');
INSERT INTO names values('Veronika Isabella');
INSERT INTO names values('Michael Karl Otto- Emil');
INSERT INTO names values('Michael karl-Otto-emil');
INSERT INTO names values('philipp');
INSERT INTO names values('Philipp');
count++"Veronika Isabella" -count=count"Michael Karl Otto Emil" -count=count"Michael karl-Otto-emil" -count++"philipp" -count++"Philipp" -count=count- Michael Wernercreate tablescript of your table andinsert into tablefor test your case in my environment - Vivek S.where name <> initcap(name)- a_horse_with_no_name