/****************************************************************************************/
/*																						*/
/*	Kroenke, Auer, Vandenberg, and Yoder - Database Concepts (8th Edition) Chapter 08	*/
/*																						*/
/*	Heather Sweeney Designs Data Warehouse Database Create Tables						*/
/*																						*/
/*	These are the Microsoft SQL Server 2016 code solutions								*/
/*																						*/
/****************************************************************************************/


/* The following statements are for creating the PAYMENT_TYPE dimension table   */
/* in the Chapter 08 Exercises.													*/


CREATE TABLE PAYMENT_TYPE(
		PaymentTypeID		Int		NOT NULL,
		PaymentType		Char(25)	NOT NULL,
		CONSTRAINT 		PAY_TYPE_PK 	PRIMARY KEY(PaymentTypeID)
	);

ALTER TABLE PRODUCT_SALES
		ADD PaymentTypeID Int NULL;

ALTER TABLE PRODUCT_SALES
		ADD CONSTRAINT  PAY_TYPE_FK
			FOREIGN KEY (PaymentTypeID)
				REFERENCES PAYMENT_TYPE(PaymentTypeID)
					ON UPDATE NO ACTION
					ON DELETE NO ACTION;
					
 