ALTER SESSION SET "_ORACLE_SCRIPT"=TRUE;
CREATE USER RESERVATION IDENTIFIED BY MANAGER;
GRANT DBA TO RESERVATION;
COMMIT;
CONNECT RESERVATION/MANAGER;
CREATE TABLE "RESERVATION"."CUSTOMER"
(
"MAILID" VARCHAR2(40) PRIMARY KEY,
"PWORD" VARCHAR2(20) NOT NULL,
"FNAME" VARCHAR2(20) NOT NULL,
"LNAME" VARCHAR2(20),
"ADDR" VARCHAR2(100),
"PHNO" NUMBER(12) NOT NULL
);
CREATE TABLE "RESERVATION"."ADMIN"
(
"MAILID" VARCHAR2(40) PRIMARY KEY,
"PWORD" VARCHAR2(20) NOT NULL,
"FNAME" VARCHAR2(20) NOT NULL,
"LNAME" VARCHAR2(20),
"ADDR" VARCHAR2(100),
"PHNO" NUMBER(12) NOT NULL
);
CREATE TABLE "RESERVATION"."TRAIN"
(
"TR_NO" NUMBER(10) PRIMARY KEY,
"TR_NAME" VARCHAR2(70) NOT NULL,
"FROM_STN" VARCHAR2(20) NOT NULL,
"TO_STN" VARCHAR2(20) NOT NULL,
"SEATS" NUMBER(4) NOT NULL,
"FARE" NUMBER(6,2) NOT NULL
);
CREATE TABLE "RESERVATION"."HISTORY"
(
"TRANSID" VARCHAR2(36) PRIMARY KEY,
"MAILID" VARCHAR2(40) REFERENCES "RESERVATION"."CUSTOMER"(MAILID),
"TR_NO" NUMBER(10),
"DATE" DATE,
"FROM_STN" VARCHAR2(20) NOT NULL,
"TO_STN" VARCHAR2(20) NOT NULL,
"SEATS" NUMBER(3) NOT NULL,
"AMOUNT" NUMBER(8,2) NOT NULL
);
COMMIT;
INSERT INTO RESERVATION.ADMIN VALUES('[email protected]','admin','System','Admin','Demo Address 123 colony','9874561230');
INSERT INTO RESERVATION.CUSTOMER VALUES('[email protected]','shashi','Shashi','Raj','Kolkata, West Bengal',954745222);
INSERT INTO RESERVATION.TRAIN VALUES(10001,'JODHPUR EXP','HOWRAH','JODHPUR', 152, 490.50);
INSERT INTO RESERVATION.TRAIN VALUES(10002,'YAMUNA EXP','GAYA','DELHI', 52, 550.50);
INSERT INTO RESERVATION.TRAIN VALUES(10003,'NILANCHAL EXP','GAYA','HOWRAH', 92, 451);
INSERT INTO RESERVATION.TRAIN VALUES(10004,'JAN SATABDI EXP','RANCHI','PATNA', 182, 550);
INSERT INTO RESERVATION.TRAIN VALUES(10005,'GANGE EXP','MUMBAI','KERALA', 12, 945);
INSERT INTO RESERVATION.TRAIN VALUES(10006,'GARIB RATH EXP','PATNA','DELHI', 1, 1450.75);
INSERT INTO RESERVATION.HISTORY VALUES('BBC374-NSDF-4673','[email protected]',10001,TO_DATE('02-FEB-2024'), 'HOWRAH', 'JODHPUR', 2, 981);
INSERT INTO RESERVATION.HISTORY VALUES('BBC375-NSDF-4675','[email protected]',10004,TO_DATE('12-JAN-2024'), 'RANCHI', 'PATNA', 1, 550);
INSERT INTO RESERVATION.HISTORY VALUES('BBC373-NSDF-4674','[email protected]',10006,TO_DATE('22-JULY-2024'), 'PATNA', 'DELHI', 3, 4352.25);
COMMIT;