--
--
--

DROP TABLE IF EXISTS customers, tapes, rentals CASCADE;

CREATE TABLE "customers" (
	"customer_id" INTEGER UNIQUE NOT NULL,
	"customer_name" CHARACTER VARYING(50) NOT NULL,
	"phone" CHARACTER(8) NULL,
	"birth_date" DATE NULL,
	"balance" DECIMAL(7,2)
);

CREATE TABLE "tapes" (
	"tape_id" CHARACTER(8) NOT NULL,
	"title" CHARACTER VARYING(80) NOT NULL,
	"duration" INTERVAL
);

CREATE TABLE "rentals" (
	"tape_id" CHARACTER(8) NOT NULL,
	"rental_date" DATE NOT NULL,
	"customer_id" INTEGER NOT NULL
);
