-1

Hello everyone I'm slightly confused by this DDL that has KEY ID_SECOND in Mysql db, what does it means? Is it foreign key or something, because I'm usually using Postgresql, and i somewhat confused like what does it equals to in postgresql though. Like if this is My DDL in Mysql:

CREATE TABLE `master (
  `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `ID_SECOND` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`),
  KEY `ID_SECOND` (`ID_SECOND`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;

And in postgresql currently this is my DDL, i don't know yet how to write that KEY ID_SECOND in the postgresql.

CREATE TABLE master (
  ID integer NOT NULL DEFAULT nextval('mst_master_id_seq'::regclass),
  ID_SECOND integer DEFAULT NULL,
  CONSTRAINT master PRIMARY KEY (id)
)

Still confused about the ID_SECOND key. Anyone knows??

Shadow
  • 33,525
  • 10
  • 51
  • 64
Maxes
  • 23
  • 6

1 Answers1

0

KEY is a synonym for INDEX, an index that is created without the usage of CREATE INDEX

Frank Heikens
  • 117,544
  • 24
  • 142
  • 135