Skip to content

sql query : show name with all vowels

Equatorial Guinea and Dominican Republic have all of the vowels (a, e, i, o, u) in the name. They don’t count because they have more than one word in the name. You can use the phrase name NOT LIKE ‘%a%’ to exclude characters from your results. The query shown misses countries like Bahamas an…

SQL – Distribution Count

Hi I have the following table: I would like to show the following: Basically I want to count the number crm_ids that have 1,2,3,4,5+ customer_ids. Thanks Answer One approach is to aggregate twice. First, aggregate over crm_id and generate counts. Then, aggregate over those counts themselves and generate a cou…

Case When syntax expression in jooq

I am trying to reproduce this MySQL query in jooq to Answer What you seem to be looking for is the SQL:2003 simple CASE expression, which allows to form something like “partial predicates” based on the case value, akin to pattern matching in other languages. This is not yet supported in jOOQ, see …

Making dynamic SQL queries to a MySQL DB

I’ve never used golang with mysql before, so I’m reading about these for the first time. I’d like to do something like this: This is far too much typing, especially if I have a dozen more variables I’d like to add to the WHERE condition. If this were PHP, I’d do something like th…

SQL Insert Into New Table from Old Table

I’ve got two table which are near identical, the only difference is the newer one has different field names. Basically the old table was outdated and needed to be re-worked; I’m trying to extract all the field where the VendorNumber = Vendor_ID all the field that are being copied to are guaranteed…

Concatenate with string but exclude when null

Oracle v11 Exclude a string in a Concat when the value is NULL? Work Query: TableA Output I’m getting Expected Output: Answer Something like this… I added simulated inputs to test all four possibilities. However, note that if you may have last name but no first name, and also first name but no las…