Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Filter/SQL/filter-1.sql
Normal file
14
Task/Filter/SQL/filter-1.sql
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
--Create the original array (table #nos) with numbers from 1 to 10
|
||||
create table #nos (v int)
|
||||
declare @n int set @n=1
|
||||
while @n<=10 begin insert into #nos values (@n) set @n=@n+1 end
|
||||
|
||||
--Select the subset that are even into the new array (table #evens)
|
||||
select v into #evens from #nos where v % 2 = 0
|
||||
|
||||
-- Show #evens
|
||||
select * from #evens
|
||||
|
||||
-- Clean up so you can edit and repeat:
|
||||
drop table #nos
|
||||
drop table #evens
|
||||
7
Task/Filter/SQL/filter-2.sql
Normal file
7
Task/Filter/SQL/filter-2.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
create temporary table nos (v int);
|
||||
insert into nos values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
create temporary table evens (v int);
|
||||
insert into evens select v from nos where v%2=0;
|
||||
select * from evens order by v; /*2,4,6,8,10*/
|
||||
drop table nos;
|
||||
drop table evens;
|
||||
1
Task/Filter/SQL/filter-3.sql
Normal file
1
Task/Filter/SQL/filter-3.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
create temporary table evens select * from nos where v%2=0;
|
||||
Loading…
Add table
Add a link
Reference in a new issue