Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6567681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:21:58+00:00 2026-05-25T14:21:58+00:00

I’m using MySQL to design a database, I’m exporting the code for generating the

  • 0

I’m using MySQL to design a database, I’m exporting the code for generating the database by using the ‘SQL Create Script’ option on the workbench. However, when I run the code, and use SHOW TABLES I get null, which probably means no table was created in the database. This is the code that was generated (its long but since it was auto generated the error is probably from a setting I had when exporting it.)

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

CREATE SCHEMA IF NOT EXISTS `travel_agency` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `travel_agency` ;

-- -----------------------------------------------------
-- Table `travel_agency`.`Region`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `travel_agency`.`Region` (
  `region_name` VARCHAR(45) NOT NULL ,
  `languages` VARCHAR(100) NOT NULL ,
  PRIMARY KEY (`region_name`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `travel_agency`.`Country`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `travel_agency`.`Country` (
  `country_name` VARCHAR(15) NOT NULL ,
  `Region_region_name` VARCHAR(45) NOT NULL ,
  `currency` CHAR(20) NOT NULL ,
  PRIMARY KEY (`country_name`, `Region_region_name`) ,
  INDEX `fk_Country_Region1` (`Region_region_name` ASC) ,
  CONSTRAINT `fk_Country_Region1`
    FOREIGN KEY (`Region_region_name` )
    REFERENCES `travel_agency`.`Region` (`region_name` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `travel_agency`.`Transport`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `travel_agency`.`Transport` (
  `Country_country_name` VARCHAR(15) NOT NULL ,
  `cost_estimate` DECIMAL(8,2) NOT NULL ,
  `transport_deals` BLOB NOT NULL ,
  `transport_rating` CHAR(1) NOT NULL ,
  PRIMARY KEY (`Country_country_name`) ,
  CONSTRAINT `fk_Transport_Country`
    FOREIGN KEY (`Country_country_name` )
    REFERENCES `travel_agency`.`Country` (`country_name` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `travel_agency`.`Resort`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `travel_agency`.`Resort` (
  `resort_name` VARCHAR(50) NOT NULL ,
  `city` VARCHAR(50) NOT NULL ,
  `Country_country_name` VARCHAR(15) NOT NULL ,
  `resort_type` CHAR(20) NOT NULL ,
  INDEX `fk_Resort_Country1` (`Country_country_name` ASC) ,
  PRIMARY KEY (`resort_name`, `city`) ,
  CONSTRAINT `fk_Resort_Country1`
    FOREIGN KEY (`Country_country_name` )
    REFERENCES `travel_agency`.`Country` (`country_name` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `travel_agency`.`Hotel`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `travel_agency`.`Hotel` (
  `hotel_name` CHAR NOT NULL ,
  `rating` CHAR(1) NOT NULL ,
  `address1` CHAR(50) NOT NULL ,
  `address2` CHAR(50) NOT NULL ,
  `postcode` CHAR(10) NOT NULL ,
  `telephone` CHAR(20) NOT NULL ,
  `Resort_resort_name` VARCHAR(50) NOT NULL ,
  PRIMARY KEY (`hotel_name`) ,
  INDEX `fk_Hotel_Resort1` (`Resort_resort_name` ASC) ,
  CONSTRAINT `fk_Hotel_Resort1`
    FOREIGN KEY (`Resort_resort_name` )
    REFERENCES `travel_agency`.`Resort` (`resort_name` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `travel_agency`.`Room`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `travel_agency`.`Room` (
  `room_num` INT NOT NULL ,
  `room_type` CHAR(10) NOT NULL ,
  `Hotel_hotel_name` CHAR NOT NULL ,
  `minibar` BIT NOT NULL ,
  `tv` BIT NOT NULL ,
  `smoking_permitted` BIT NOT NULL ,
  INDEX `fk_Room_Hotel1` (`Hotel_hotel_name` ASC) ,
  PRIMARY KEY (`room_num`, `room_type`) ,
  CONSTRAINT `fk_Room_Hotel1`
    FOREIGN KEY (`Hotel_hotel_name` )
    REFERENCES `travel_agency`.`Hotel` (`hotel_name` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `travel_agency`.`Guest`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `travel_agency`.`Guest` (
  `guest_id` INT NOT NULL ,
  `firstname` VARCHAR(20) NOT NULL ,
  `surname` VARCHAR(20) NOT NULL ,
  `mobilephone` CHAR(20) NOT NULL ,
  PRIMARY KEY (`guest_id`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `travel_agency`.`Bookings`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `travel_agency`.`Bookings` (
  `Guest_guest_id` INT NOT NULL ,
  `Hotel_hotel_name` CHAR NOT NULL ,
  `guest_count` INT NOT NULL ,
  PRIMARY KEY (`Guest_guest_id`, `Hotel_hotel_name`) ,
  INDEX `fk_Booking_Guest1` (`Guest_guest_id` ASC) ,
  INDEX `fk_Booking_Hotel1` (`Hotel_hotel_name` ASC) ,
  CONSTRAINT `fk_Booking_Guest1`
    FOREIGN KEY (`Guest_guest_id` )
    REFERENCES `travel_agency`.`Guest` (`guest_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_Booking_Hotel1`
    FOREIGN KEY (`Hotel_hotel_name` )
    REFERENCES `travel_agency`.`Hotel` (`hotel_name` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `travel_agency`.`HotelFacilities`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `travel_agency`.`HotelFacilities` (
  `Hotel_hotel_name` CHAR NOT NULL ,
  `internet_access` BIT NOT NULL ,
  `hotel_restaurant` BIT NOT NULL ,
  `games_room` BIT NOT NULL ,
  `bar` BIT NOT NULL ,
  `evening_shows` BIT NOT NULL ,
  `massage_parlour` BIT NOT NULL ,
  `misc_details` BLOB NOT NULL ,
  PRIMARY KEY (`Hotel_hotel_name`) ,
  CONSTRAINT `fk_HotelFacilities_Hotel1`
    FOREIGN KEY (`Hotel_hotel_name` )
    REFERENCES `travel_agency`.`Hotel` (`hotel_name` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `travel_agency`.`Attractions`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `travel_agency`.`Attractions` (
  `Region_region_name` VARCHAR(45) NOT NULL ,
  `dirt_mountains` BIT NOT NULL ,
  `beaches` BIT NOT NULL ,
  `casinos` BIT NOT NULL ,
  `safari` BIT NOT NULL ,
  `snow_mountains` BIT NOT NULL ,
  `misc_details` BLOB NOT NULL ,
  PRIMARY KEY (`Region_region_name`) ,
  CONSTRAINT `fk_Attractions_Region1`
    FOREIGN KEY (`Region_region_name` )
    REFERENCES `travel_agency`.`Region` (`region_name` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `travel_agency`.`Rate`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `travel_agency`.`Rate` (
  `Hotel_hotel_name` CHAR NOT NULL ,
  `Room_room_num` INT NOT NULL ,
  `Room_room_type` CHAR(10) NOT NULL ,
  `first_quarter` DECIMAL(20,2) NOT NULL ,
  `second_quarter` DECIMAL(20,2) NOT NULL ,
  `third_quarter` DECIMAL(20,2) NOT NULL ,
  `fourth_quarter` DECIMAL(20,2) NOT NULL ,
  `discount_information` BLOB NOT NULL ,
  PRIMARY KEY (`Hotel_hotel_name`, `Room_room_num`, `Room_room_type`) ,
  INDEX `fk_Rate_Room1` (`Room_room_num` ASC, `Room_room_type` ASC) ,
  CONSTRAINT `fk_Rate_Hotel1`
    FOREIGN KEY (`Hotel_hotel_name` )
    REFERENCES `travel_agency`.`Hotel` (`hotel_name` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_Rate_Room1`
    FOREIGN KEY (`Room_room_num` , `Room_room_type` )
    REFERENCES `travel_agency`.`Room` (`room_num` , `room_type` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;



SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

I'm using sql command line client and putting the code but it doesn't work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:21:59+00:00Added an answer on May 25, 2026 at 2:21 pm

    Its because you’re using command line client as your database. That just makes your pc function as a database but doesn’t exactly have all features a professional database would have. And MySQL workbench is designed to export code for databases more professional.

    Since you’re using command line client I’m assuming this is either practice or homework of some sort? Either way, this is the way the code would work in Command line client. Try this.

    CREATE TABLE Region 
    (
     region_name VARCHAR(45) NOT NULL ,
     languages VARCHAR(100) NOT NULL ,
     PRIMARY KEY (region_name) 
     );
    
    CREATE TABLE Country
    (
     country_name VARCHAR(15) NOT NULL ,
     Region_region_name VARCHAR(45) NOT NULL ,
     currency CHAR(20) NOT NULL ,
     PRIMARY KEY (country_name, Region_region_name) ,
     CONSTRAINT fk_Country_Region1
      FOREIGN KEY (Region_region_name )
      REFERENCES Region (region_name )
        );
    
    CREATE TABLE Transport (
     Country_country_name VARCHAR(15) NOT NULL ,
     cost_estimate DECIMAL(8,2) NOT NULL ,
     transport_deals CHAR(100) NULL ,
     transport_rating CHAR(20) NOT NULL ,
     PRIMARY KEY (Country_country_name) ,
     CONSTRAINT fk_Transport_Country
      FOREIGN KEY (Country_country_name)
      REFERENCES Country (country_name )
        );
    
    CREATE TABLE Resort (
     resort_name VARCHAR(50) NOT NULL ,
     Country_country_name VARCHAR(15) NOT NULL ,
     resort_type CHAR(20) NOT NULL ,
     PRIMARY KEY (resort_name) ,
     CONSTRAINT fk_Resort_Country1
      FOREIGN KEY (Country_country_name)
      REFERENCES Country (country_name)
    );
    
    CREATE TABLE Hotel (
     hotel_name CHAR(20) NOT NULL ,
     rating CHAR NOT NULL ,
     address1 CHAR(50) NOT NULL ,
     address2 CHAR(50) NOT NULL ,
     postcode CHAR(10) NOT NULL ,
     telephone CHAR(20) NOT NULL ,
     Resort_resort_name VARCHAR(50) NOT NULL ,
     PRIMARY KEY (hotel_name) ,
     CONSTRAINT fk_Hotel_Resort1
      FOREIGN KEY (Resort_resort_name)
      REFERENCES Resort (resort_name)
    );
    
    
    CREATE TABLE Room (
     room_num INT NOT NULL ,
     room_type CHAR(10) NOT NULL ,
     Hotel_hotel_name CHAR(20) NOT NULL ,
     minibar BOOLEAN NOT NULL ,
     tv BOOLEAN NOT NULL ,
     smoking_permitted BOOLEAN NOT NULL ,
     PRIMARY KEY (room_num) ,
     CONSTRAINT fk_Room_Hotel1
      FOREIGN KEY (Hotel_hotel_name)
      REFERENCES Hotel (hotel_name)
        );
    
    CREATE TABLE Guest (
     guest_id INT NOT NULL ,
     firstname VARCHAR(20) NOT NULL ,
     surname VARCHAR(20) NOT NULL ,
     mobilephone CHAR(20) NOT NULL ,
     PRIMARY KEY (guest_id) 
     );
    
    CREATE TABLE Bookings (
     Guest_guest_id INT NOT NULL ,
     Hotel_hotel_name CHAR(20) NOT NULL ,
     guest_count INT NOT NULL ,
     PRIMARY KEY (Guest_guest_id, Hotel_hotel_name) ,
     CONSTRAINT fk_Booking_Guest1
      FOREIGN KEY (Guest_guest_id)
      REFERENCES Guest (guest_id),
     CONSTRAINT fk_Booking_Hotel1
      FOREIGN KEY (Hotel_hotel_name)
      REFERENCES Hotel (hotel_name)
    );
    
    CREATE TABLE HotelFacilities (
     Hotel_hotel_name CHAR(20) NOT NULL ,
     internet_access BOOLEAN NOT NULL ,
     hotel_restaurant BOOLEAN NOT NULL ,
     games_room BOOLEAN NOT NULL ,
     bar BOOLEAN NOT NULL ,
     evening_shows BOOLEAN NOT NULL ,
     massage_parlour BOOLEAN NOT NULL ,
     misc_details CHAR(100) NULL ,
     PRIMARY KEY (Hotel_hotel_name) ,
     CONSTRAINT fk_HotelFacilities_Hotel1
      FOREIGN KEY (Hotel_hotel_name)
      REFERENCES Hotel (hotel_name)
        );
    
    CREATE TABLE Attractions (
     Region_region_name VARCHAR(45) NOT NULL ,
     dirt_mountains BOOLEAN NOT NULL ,
     beaches BOOLEAN NOT NULL ,
     casinos BOOLEAN NOT NULL ,
     safari BOOLEAN NOT NULL ,
     snow_mountains BOOLEAN NOT NULL ,
     misc_details CHAR(100) NULL ,
     PRIMARY KEY (Region_region_name) ,
     CONSTRAINT fk_Attractions_Region1
      FOREIGN KEY (Region_region_name )
      REFERENCES Region (region_name )
      );
    
    CREATE TABLE Rate (
     Hotel_hotel_name CHAR(20) NOT NULL ,
     Room_room_num INT NOT NULL ,
     first_quarter DECIMAL(10,2) NOT NULL ,
     second_quarter DECIMAL(10,2) NOT NULL ,
     third_quarter DECIMAL(10,2) NOT NULL ,
     fourth_quarter DECIMAL(10,2) NOT NULL ,
     discount_information CHAR(100) NULL ,
     PRIMARY KEY (Hotel_hotel_name, Room_room_num) ,
     CONSTRAINT fk_Rate_Hotel1
      FOREIGN KEY (Hotel_hotel_name )
      REFERENCES Hotel (hotel_name ),
     CONSTRAINT fk_Rate_Room1
      FOREIGN KEY (Room_room_num)
      REFERENCES Room (room_num)
      );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am using Paperclip to handle profile photo uploads in my app. They upload
I am writing an app with both english and french support. The app requests
I'm parsing an XML file, the creators of it stuck in a bunch social
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.