Skip to content
Advertisement

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 and Belarus because they contain at least

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 count of counts. Have a look at a demo below, given

How to get maximum number of concurrent events in postgresql?

I have a table named events like this: These events could have overlaps, and I want to know maximum number of overlapping events that have occurred over a time span. For example, in a situation like this: The answer is 2, because at most 2 events overlap at 10:30 until 10:35. I’m using Postgres 9.6 Answer Here is the idea:

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 Issue #3223. Interestingly, though, your SQL example

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 this: By using a foreach loop, I

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 empty. The below SQL code if very large,

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 last name, the combined column will show

Advertisement