Create Payments table program in SQL

Question:

Create Payments table

Refer the below schema and create the table payments.

Column Name Datatype Size Constraint Constraint name Reference table – Column name
Payment_ID Varchar2 3 PRIMARY KEY PK_PAYMENTS  
Ticket_ID Varchar2 3 FOREIGN KEY  FK_PAYMENTS_TICKETS TICKETS – TICKET_ID
BD_ID Number 11 FOREIGN KEY  FK_PAYMENTS_BOOKINGDETAILS BOOKINGDETAILS-BD_ID
DISCOUNT_ID Varchar2 3 FOREIGN KEY  FK_PAYMENTS_DISCOUNTS DISCOUNTS-DISCOUNT_ID

CODE:

create table payments(
	Payment_ID  varchar2(3),
  	Ticket_ID varchar2(3),
  	BD_ID number(11),
	DISCOUNT_ID varchar2(3),
  	constraint PK_PAYMENTS primary key(Payment_ID),
	constraint FK_PAYMENTS_TICKETS foreign key(Ticket_ID) references TICKETS(Ticket_ID),
  	constraint FK_PAYMENTS_BOOKINGDETAILS foreign key(BD_ID) references BOOKINGDETAILS(BD_ID),
  	constraint FK_PAYMENTS_DISCOUNTS foreign key(DISCOUNT_ID) references DISCOUNTS(DISCOUNT_ID)
);

rdbms programs | rdbms programs with output | rdbms programming languages | rdbms database program

Leave a Comment

Scroll to Top