Created
July 7, 2022 19:08
-
-
Save KelWill/e6ab0d7ba729064ba8aa4583ac0d30e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace view digits as | |
select 0 as d union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9; | |
drop table if exists nums; | |
create table nums (n int auto_increment, primary key(n)); | |
insert into nums values (), (); | |
insert into nums () select null from nums n1, nums n2, nums n3, nums n4, nums n5; | |
insert into nums () select null from nums n1, nums n2; | |
select all_nums.n | |
from ( | |
select 1 + h * 100 + t * 10 + o n | |
from ( | |
select h.d as h, t.d as t, o.d as o | |
FROM digits as h, digits as t, digits as o | |
) nums | |
) all_nums | |
LEFT JOIN nums ON all_nums.n = nums.n | |
where nums.n is null; | |
-- skips digits from 40 - 61 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment