PostgreSQL中,database,schema,table之间关系
从逻辑上看,schema,table,都是位于database之下。
首先,在postgres数据库下建立表(相当于建立在public schema下):
[pgsql@localhost bin]$ ./psql -d postgres
psql (9.1.2)
Type "help" for help. postgres=# create table tab200(id integer);
CREATE TABLE
postgres=# \q
然后,再在tester数据库下建立表(相当于建立在public schema下):
[pgsql@localhost bin]$ ./psql -d tester
psql (9.1.2)
Type "help" for help. tester=# create table tab200(id integer);
CREATE TABLE
tester=# \q
然后,再在其他的数据库下进行查看:
[pgsql@localhost bin]$ ./psql
psql (9.1.2)
Type "help" for help. pgsql=# SELECT * FROM information_schema.tables WHERE table_name='tab200';
table_catalog | table_schema | table_name | table_type | self_referencing_column_name | reference_generation | user_de
fined_type_catalog | user_defined_type_schema | user_defined_type_name | is_insertable_into | is_typed | commit_action
---------------+--------------+------------+------------+------------------------------+----------------------+--------
-------------------+--------------------------+------------------------+--------------------+----------+---------------
(0 rows) pgsql=# \q
然后,再在 postgres数据库和tester数据库下分别查看:
[pgsql@localhost bin]$ ./psql -d tester
psql (9.1.2)
Type "help" for help. tester=# SELECT * FROM information_schema.tables WHERE table_name='tab200';
table_catalog | table_schema | table_name | table_type | self_referencing_column_name | reference_generation | user_de
fined_type_catalog | user_defined_type_schema | user_defined_type_name | is_insertable_into | is_typed | commit_action
---------------+--------------+------------+------------+------------------------------+----------------------+--------
-------------------+--------------------------+------------------------+--------------------+----------+---------------
tester | public | tab200 | BASE TABLE | | |
| | | YES | NO |
(1 row) tester=# \q
[pgsql@localhost bin]$ ./psql -d postgres
psql (9.1.2)
Type "help" for help. postgres=# SELECT * FROM information_schema.tables WHERE table_name='tab200';
table_catalog | table_schema | table_name | table_type | self_referencing_column_name | reference_generation | user_de
fined_type_catalog | user_defined_type_schema | user_defined_type_name | is_insertable_into | is_typed | commit_action
---------------+--------------+------------+------------+------------------------------+----------------------+--------
-------------------+--------------------------+------------------------+--------------------+----------+---------------
postgres | public | tab200 | BASE TABLE | | |
| | | YES | NO |
(1 row)
PostgreSQL中,database,schema,table之间关系的更多相关文章
- Android中sp和px之间关系探究
记得当时在刚接触Android时都在说不要用px,要用sp,所以在实际工作当中当然就按照这个规则,所以都要将px换算成sp,而我在实际工作中的换算规则是dp=px * 1.5,而且用这种规则到现在基本 ...
- Excel Open Xml中CellStyleXfs,cellStyle,cellXfs之间关系的总结
最近这几个东东打交道了几天,总算是弄明白了,综合多个帖子,现在总结如下: 在创建stylesheet时,必须创建fonts,Fills,Borders 和cellXfs(CellFormats)四个节 ...
- PostgreSQL模式(schema)介绍
一个PostgreSQL数据库集群包含一个或多个已命名数据库.用户和用户组在整个集群范围内是共享的,但是其它数据并不共享.任何与服务器连接的客户都只能访问那个在连接请求里声明的数据库. 注意: 集群中 ...
- [原创]PostgreSQL中十进制、二进制、十六进制之间的相互转换
在PostgreSQL中,二进制.十进制.十六进制之间的转换是非常方便的,如下: 十进制转十六进制和二进制 mydb=# SELECT to_hex(10); to_hex -------- a (1 ...
- Postgresql中临时表(temporary table)的特性和用法
熟悉Oracle的人,相比对临时表(temporary table)并不陌生,很多场景对解决问题起到不错的作用,开源库Postgresql中,也有临时表的概念,虽然和Oracle中临时表名字相同,使用 ...
- PostgreSQL、SQL Server数据库中的数据类型的映射关系
PostgreSQL 8.1 轰动发布,我也打算将原来使用 SQL Server 的一些应用迁移到 PostgreSQL 上,首先需要迁移的是表,那么这就必须要先搞清楚这两个数据库中的数据类型的映射关 ...
- talend openstudio 在OracleInput组件中guess Schema 出现Database connection is failed 的错误
错误描述: talend openstudio 在OracleInput组件中guess Schema 出现Database connection is failed 的错误. 查看错误详情,发现错误 ...
- HBase入门实例: Table中Family和Qualifier的关系与区别
Table中Family和Qualifier的关系与区别 就像用MySQL一样,我们要做的是表设计,MySQL中的表,行,列的在HBase已经有所区别了,在HBase中主要是Table和Family和 ...
- 数据库中的Schema是什么?
在数据库中,schema(发音 “skee-muh” 或者“skee-mah”,中文叫模式)是数据库的组织和结构,schemas andschemata都可以作为复数形式.模式中包含了schema对象 ...
随机推荐
- apache开源项目 -- tez
为了更高效地运行存在依赖关系的作业(比如Pig和Hive产生的MapReduce作业),减少磁盘和网络IO,Hortonworks开发了DAG计 算框架Tez.Tez是从MapReduce计算框架演化 ...
- Doubango ims 框架 分析之 多媒体部分
序言 RTP提供带有实时特性的端对端数据传输服务,传输的数据如:交互式的音频和视频.那些服务包括有效载荷类型定义,序列号,时间戳和传输监测控制.应用程序在UDP上运行RTP来使用它的多路技术和chec ...
- 查看buffer cache命中率
SQL> select name,value from v$sysstat where name in('db block gets','consistent gets','physical r ...
- 【转】iOS中定时器NSTimer的使用
原文网址:http://www.cnblogs.com/zhulin/archive/2012/02/02/2335866.html 1.初始化 + (NSTimer *)timerWithTimeI ...
- 【转】一个windows线程池实现
#ifndef _ThreadPool_H_ #define _ThreadPool_H_ #pragma warning(disable: 4530) #pragma warning(disable ...
- hdu 1024(最大和连续子序列增强版)
题意:最大和连续子序列的增强版,要求从一序列中取出若干段,这些段之间不能交叉,使得和最大并输出. 分析:用dp[i][j]表示前j个数取出i段得到的最大值,那么状态转移方程为dp[i][j]=max( ...
- Codeforces Round #361 (Div. 2) 套题
A - Mike and Cellphone 问有没有多解,每个点按照给出的序列用向量法跑一遍 #include<cstdio> #include<cstring> #incl ...
- 求职基础复习之快速排序c++版
#include<iostream> using namespace std; int partition(int a[],int p,int q){ int x = a[q]; ; fo ...
- POJ 2280&&hdu 1661
题意:给定平面上的N个点,属性分别标记为0和1,然后找一条直线,直线上的点全部溶解,一侧的1溶解,另一侧的0溶解.求出最多能溶解的点的个数. 思路:暴力枚举每个点,扫描线旋转.先做优化,如果一侧溶解0 ...
- CTS FAIL(一)
首先简单介绍下CTS:全称Compatibility Test Suite,通过CTS测试,来检测android apk与android系统的兼容性. 最近公司release一版新的Image,但在新 ...