/* Copyright 2017 Amazon.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ create table ticket_purchase_hist ( sporting_event_ticket_id NUMBER NOT NUll constraint tph_sport_event_tic_id references sporting_event_ticket(id) ,purchased_by_id NUMBER NOT NULL constraint tph_ticketholder_id references person(id) ,transaction_date_time DATE NOT NULL ,transferred_from_id NUMBER constraint tph_transfer_from_id references person(id) ,purchase_price NUMBER(8,2) NOT NULL ,constraint ticket_purchase_hist_pk primary key(sporting_event_ticket_id, purchased_by_id, transaction_date_time) ); create index tph_purch_by_id on ticket_purchase_hist(purchased_by_id); create index tph_trans_from_id on ticket_purchase_hist(transferred_from_id);