我创建了一些使用Oracle SQL具有相关表的表。我的讲师希望我将这些迁移到一个mongodb,我在网上搜索,但我对他们正在做的事情一无所知。我知道如何设置mongodb并获得连接,但我不知道如何迁移到mongodb。
这是我创建的表格
CREATE TABLE TBL_EVENT_ORDER
(
ORDER_ID INT CONSTRAINT PK_TBL_EVENT_ORDER
PRIMARY KEY,
CLIENT_ID VARCHAR2(10),
CONSTRAINT FK_CLIENT FOREIGN KEY (CLIENT_ID) REFERENCES
TBL_CLIENT(CLIENT_ID),
ORDER_DATE DATE DEFAULT SYSDATE,
EVENT_ID INT DEFAULT 1,
CONSTRAINT FK_WINE_EVENT FOREIGN KEY (EVENT_ID) REFERENCES
TBL_WINE_EVENT(EVENT_ID)
);
CREATE INDEX IDX_FK_CLIENT_ID_TBL_CLIENT ON TBL_EVENT_ORDER(CLIENT_ID);
INSERT INTO TBL_EVENT_ORDER VALUES
(1,'1',DEFAULT,'1');
INSERT INTO TBL_EVENT_ORDER VALUES
(2,'2',DEFAULT,'1');
INSERT INTO TBL_EVENT_ORDER VALUES
(3,'3',DEFAULT,'1');
INSERT INTO TBL_EVENT_ORDER VALUES
(4,'4',DEFAULT,'1');
CREATE TABLE TBL_WINE
(
WINE_ID INT CONSTRAINT PK_WINE PRIMARY KEY,
WINE_NAME VARCHAR2(20),
PRICE NUMBER(6,2) CONSTRAINT NN_PRICE NOT NULL,
WINE_TYPE VARCHAR2(20) CONSTRAINT NN_WINE_TYPE NOT NULL,
WINE_YEAR INT CONSTRAINT NN_WINE_AGE NOT NULL,
WINE_COUNTRY VARCHAR2(20),
WINE_REGION VARCHAR2(20)
);
INSERT INTO TBL_WINE VALUES
(1,'AGUILA RED',100.50,'BORDEAUX',2010,'COUNTRY1','REGION1');
INSERT INTO TBL_WINE VALUES
(2,'CLOUD BAY',150,'BORDEAUX',2010,'COUNTRY2','REGION2');
INSERT INTO TBL_WINE VALUES
(3,'HARLAN ESTATE',175.50,'BORDEAUX',2010,'COUNTRY3','REGION3');
INSERT INTO TBL_WINE VALUES
(4,'KRUG',200,'BORDEAUX',2010,'COUNTRY4','REGION4');
CREATE TABLE TBL_ORDER_DETAIL
(
ORDER_ID INT,
WINE_ID INT,
CONSTRAINT PK_ORDER_DETAIL PRIMARY KEY (ORDER_ID, WINE_ID),
CONSTRAINT FK_EVENT_ORDER FOREIGN KEY (ORDER_ID) REFERENCES
TBL_EVENT_ORDER(ORDER_ID),
ORDER_QTY INT CONSTRAINT NN_ORDER_QTY NOT NULL,
UNIT_PRICE NUMBER(6,2),
EXCLUSIVE_IMPORT CHAR(1)
);
CREATE INDEX IDX_FK_ORDER_ID_EVENT_ORDER ON TBL_ORDER_DETAIL(ORDER_ID);
CREATE INDEX IDX_FK_WINE_ID_WINE ON TBL_ORDER_DETAIL(WINE_ID);
INSERT INTO TBL_ORDER_DETAIL VALUES
(1,1,3,100.50,'N');
INSERT INTO TBL_ORDER_DETAIL VALUES
(2,2,1,150,'N');
INSERT INTO TBL_ORDER_DETAIL VALUES
(3,3,4,175.50,'N');
INSERT INTO TBL_ORDER_DETAIL VALUES
(4,4,2,200,'Y');