Create Payments table in SQL

Question:

Create Payments table

Refer the below schema and create the table payments.

Column NameDatatypeSizeConstraintConstraint nameReference table – Column name
Payment_IDVarchar23PRIMARY KEYPK_PAYMENTS 
Ticket_IDVarchar23FOREIGN KEY FK_PAYMENTS_TICKETSTICKETS – TICKET_ID
BD_IDNumber11FOREIGN KEY FK_PAYMENTS_BOOKINGDETAILSBOOKINGDETAILS-BD_ID
DISCOUNT_IDVarchar23FOREIGN KEY FK_PAYMENTS_DISCOUNTSDISCOUNTS-DISCOUNT_ID
Quiz for Exam -  Create Payments table

Code:

Main.sql

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)
);

Recommended:

Leave a Comment

Your email address will not be published. Required fields are marked *

x