如何将以下查询转换为 postgresql
CREATE TABLE IF NOT EXISTS `p_reqstats` (
`sdate` int(10) unsigned NOT NULL,
`deptID` int(10) unsigned NOT NULL,
`opID` int(10) unsigned NOT NULL,
`requests` int(10) NOT NULL,
`taken` smallint(5) unsigned NOT NULL,
`declined` smallint(5) unsigned NOT NULL,
`message` smallint(5) unsigned NOT NULL,
`initiated` smallint(5) unsigned NOT NULL,
`initiated_taken` smallint(5) unsigned NOT NULL,
`rateit` smallint(5) unsigned NOT NULL,
`ratings` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`sdate`,`deptID`,`opID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
我实际上想知道一部分:
PRIMARY KEY (sdate,deptID,opID)Here the problem occurs because the
CREATE TABLE IF NOT EXISTS `p_reqstats` (
`sdate` int(10) unsigned NOT NULL,
`deptID` int(10) unsigned NOT NULL,
`opID` int(10) unsigned NOT NULL,
`requests` int(10) NOT NULL,
`taken` smallint(5) unsigned NOT NULL,
`declined` smallint(5) unsigned NOT NULL,
`message` smallint(5) unsigned NOT NULL,
`initiated` smallint(5) unsigned NOT NULL,
`initiated_taken` smallint(5) unsigned NOT NULL,
`rateit` smallint(5) unsigned NOT NULL,
`ratings` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`sdate`,`deptID`,`opID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
I wonder in fact part :
PRIMARY KEY (sdate,deptID,opID)
Here the problem occurs because the
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一些问题:
IF NOT EXISTS
。int(10)
的含义,您只需要int
。unsigned
是什么意思。smallint
,但int
。所以这样的事情应该可以工作:
如果您需要无符号值会给您带来的额外空间
那么你可以使用
bigint
而不是int
。A few issues:
IF NOT EXISTS
unless you're using 9.1 or higher.int(10)
means, you just wantint
.unsigned
means.smallint
is supported butint
is recommended unless you are tight on disk space.So something like this should work:
If you needed the extra space that an unsigned value would give you
then you could use
bigint
instead ofint
.