I have a table mytable in ORACLE database having only one column Roll_no like following:
Roll_no
----------
CD01 0001
CD01 0002
CD01 0004
CD01 0005
CD01 0008
here CD01 is fixed, after CD01 one space is there and then numbers are written 0001 and onwards.
Please see here that CD01 0003, CD01 0006, CD01 0007 are missing and these are my required output.
Required output:
Roll_no
----------
CD01 0003
CD01 0006
CD01 0007
How can I write a SQL query to find out these missing alphanumeric characters? Any ideas please
You could generate the full list of number and then with a NOT EXISTS (or NOT IN) filter the existing records out. For example:
Here’s how it works: