建立测试数据新建两个表t1, t2, 每个表有100万的数据。有999990是相同的。现在要找到在t1的数据,而不再t2的数据。postgres=# explain select * from t1 where id not in (select id from t2); QUERY PLAN --------------------...【阅读全文】
删除的例子误删postgres=# delete from test where id = 2;DELETE 1 id | info ----+------ 1 | abc(1 row) 恢复由于Postgresql的vacuum机制,删除的数据,并不会立刻删掉。只是做了相关的标志。如果vacuum一旦清理了这些数据,那么是无法恢复。vacuum的机制请参考官方文档或者其他相关的资料。...【阅读全文】
$sql="select * from article where id=1"和 $sql="select * from article where id=1"都可以得到正确的结果,但有时分开写或许能 更明了一点,特别是当sql语句比较长时。可以用in 来实现 $sql="select * from article where id ;in(1,3,5)"$sql="select concat(id,"-",con) as res from article where id=1"返回...【阅读全文】