CREATE TABLE CREWS (
  CREW_ID INT AUTO_INCREMENT PRIMARY KEY,
  CREW VARCHAR(80) NOT NULL,
  DESCRIPTION VARCHAR(160),
  KEYWORDS VARCHAR(160),
  URL VARCHAR(80),
  INDEX ( CREW_ID ),
  INDEX ( NAME )
);

CREATE TABLE CREWS_PERSONS (
  CREW_ID INT NOT NULL,
  PERSON_ID INT NOT NULL,
  TITLE VARCHAR(80),
  INDEX ( CREW_ID ),
  INDEX ( PERSON_ID )
);

CREATE TABLE PERSONS (
  PERSON_ID INT AUTO_INCREMENT PRIMARY KEY,
  NAME VARCHAR(80) NOT NULL,
  DESCRIPTION VARCHAR(160),
  EMAIL VARCHAR(80),
  URL VARCHAR(80),
  KEYWORDS VARCHAR(160),
  PICTURE LONGBLOB,
  INDEX ( PERSON_ID ),
  INDEX ( NAME )
);

CREATE TABLE CONTACTS (
  PERSON_ID INT PRIMARY KEY,
  TITLE VARCHAR(80),
  PHONE VARCHAR(80),
  PAGER VARCHAR(20),
  CELL VARCHAR(20),
  FAX VARCHAR(10),
  EMAIL VARCHAR(80),
  ADDRESS1 VARCHAR(80),
  ADDRESS2 VARCHAR(80),
  CITY VARCHAR(80),
  STATE VARCHAR(80),
  ZIP VARCHAR(10),
  COUNTRY CHAR(2),
);

CREATE TABLE PERSONS_SETS (
  PERSON_ID INT NOT NULL,
  SET_ID INT NOT NULL,
  INDEX ( PERSON_ID ),
  INDEX ( SET_ID )
);

CREATE TABLE SETS (
  SET_ID INT AUTO_INCREMENT PRIMARY KEY,
  SETSTART DATETIME NOT NULL,
  DURATION INT,
  DESCRIPTION VARCHAR(160),
  KEYWORDS VARCHAR(160),
  SHOW_ID INT NOT NULL,
  INDEX ( SETSTART ),
  INDEX ( SHOW_ID )
);

CREATE TABLE PERSONS_SHOWS (
  PERSON_ID INT NOT NULL,
  SHOW_ID INT NOT NULL,
  INDEX ( PERSON_ID ),
  INDEX ( SET_ID )
);

CREATE TABLE SHOWS (
  SHOW_ID INT AUTO_INCREMENT PRIMARY KEY,
  REPEAT_SHOW_ID INT,
  SHOW VARCHAR(80) NOT NULL,
  DESCRIPTION VARCHAR(160),
  SHOWSTART DATETIME NOT NULL,
  DURATION INT,
  STUDIO_ID INT NOT NULL,
  INDEX ( SHOWSTART ),
  INDEX ( STUDIO_ID )
);

CREATE TABLE FILE (
  FILE_ID AUTO_INCREMENT PRIMARY KEY,
  FILENAME VARCHAR(80),
  FILESIZE INT,
  SHOW_ID INT,
  INDEX ( FILE_ID ),
  INDEX ( SHOW_ID )
);

CREATE TABLE DOWNLOADS (
  FILE_ID INT NOT NULL,
  WHEN DATETIME NOT NULL,
  INDEX ( FILE_ID ),
  INDEX ( WHEN )
);

CREATE TABLE STUDIOS (
  STUDIO_ID INT AUTO_INCREMENT PRIMARY KEY,
  NAME VARCHAR(80),
  ISLIVE CHAR(1)
);

CREATE TABLE GEARS (
  GEAR_ID INT AUTO_INCREMENT PRIMARY KEY,
  GEAR VARCHAR(80) NOT NULL,
  DESCRIPTION VARCHAR(160),
  PRICE FLOAT
  URL VARCHAR(80),
);

CREATE TABLE PERSONS_GEARS (
  GEAR_ID INT NOT NULL,
  PERSON_ID INT NOT NULL,
  INDEX ( GEAR_ID ),
  INDEX ( PERSON_ID )
);

CREATE TABLE CREWS_GEARS (
  GEAR_ID INT NOT NULL,
  CREW_ID INT NOT NULL,
  INDEX ( GEAR_ID ),
  INDEX ( CREW_ID )
);


