现一个表中有很多字段,但我不想要其中某一个字段,手打出来字段太多,不方便. SELECT GROUP_CONCAT( column_name SEPARATOR ',' ) FROM information_schema.COLUMNS WHERE column_name <> '你不想要的字段名' AND table_name = '表名' GROUP BY table_name…
转载自:http://blog.csdn.net/cicon/article/details/51577655 获取表名及注释: select relname as tabname,cast(obj_description(relfilenode,'pg_class') as varchar) as comment from pg_class c where relkind = 'r' and relname not like 'pg_%' and relname not like 'sql…
获取表名及注释: select relname as tabname,cast(obj_description(relfilenode,'pg_class') as varchar) as comment from pg_class c where relkind = 'r' and relname not like 'pg_%' and relname not like 'sql_%' order by relname 过滤掉分表: 加条件 and relchecks=0 即可 获取字段名.…
参考代码: /** * 获取主键字段 * @param $table * @param $database * @return mixed */ public function get_primary_key($table,$database){ $sql = "SELECT k.column_name FROM information_schema.table_constraints t JOIN information_schema.key_column_usage k USING (con…
PostgreSQL获取数据库中所有table名: SELECT tablename FROM pg_tables WHERE tablename NOT LIKE 'pg%' AND tablename NOT LIKE 'sql_%' ORDER BY tablename; PostgreSQL获取数据库中所有table名及table的注解信息: SELECT tablename, obj_description(relfilenode, 'pg_class') FROM pg_tables…