text: DROP DATABASE IF EXISTS platzi_operation;
  
  CREATE DATABASE platzi_operation;
  USE platzi_operation;
  
  CREATE TABLE `authors` (
    `author_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(100) NOT NULL,
    `nationality` varchar(100) DEFAULT NULL,
    PRIMARY KEY (`author_id`),
    UNIQUE KEY `uniq_author` (`name`)
  ) ENGINE=InnoDB AUTO_INCREMENT=193 DEFAULT CHARSET=utf8;
  
  
  CREATE TABLE `clients` (
    `client_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(50) DEFAULT NULL,
    `email` varchar(100) NOT NULL,
    `birthdate` date DEFAULT NULL,
    `gender` enum('M','F') DEFAULT NULL,
    `active` tinyint(1) NOT NULL DEFAULT '1',
    `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`client_id`),
    UNIQUE KEY `email` (`email`)
  ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8;
  
  
  CREATE TABLE `transactions` (
    `transaction_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `book_id` int(10) unsigned NOT NULL,
    `client_id` int(10) unsigned NOT NULL,
    `type` enum('lend','sell') NOT NULL,
    `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `modified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    `finished` tinyint(1) NOT NULL DEFAULT '0',
    PRIMARY KEY (`transaction_id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  CREATE TABLE `books` (
    `book_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `author_id` int(10) unsigned DEFAULT NULL,
    `title` varchar(100) NOT NULL,
    `year` int(11) NOT NULL DEFAULT '1900',
    `language` varchar(2) NOT NULL COMMENT 'ISO 639-1 Language code (2 chars)',
    `cover_url` varchar(500) DEFAULT NULL,
    `price` double(6,2) DEFAULT NULL,
    `sellable` tinyint(1) NOT NULL DEFAULT '0',
    `copies` int(11) NOT NULL DEFAULT '1',
    `description` text,
    PRIMARY KEY (`book_id`),
    UNIQUE KEY `book_language` (`title`,`language`)
  ) ENGINE=InnoDB AUTO_INCREMENT=199 DEFAULT CHARSET=utf8;