some rudimentary SQL
Posted by peeterjoot on October 28, 2009
Ironically, despite 10 years of working on a database, my work has been so far in the guts that I rarely have to do any SQL myself. At one point when I’d been drafted for some some project management related work I did some fancy stuff with it making forms with python to compare regression results, but I’ve already forgotten all that. Here’s a couple notes to myself of the very simplest stuff.
— create a table. Note the backwards “prototype” compared to a C function;)
create table b (x int)
— how many rows?
select count(*) from b
— double table size
insert into b select * from b
–touch the whole thing to force IO and general activity in the database engine
update b set x = (x+1)