Why am I not able to inspect my database's tables?

249 Views Asked by At

I'll start by saying that my experience in mySQL is limited. I've only been using workbench for a few months. Me and a couple of buddies are working on a database for a pet shop scenario, and I've been tasked with writing some queries to test it out. At first my pal's script for the database wasn't running, because I was getting errors with the "VISIBLE" keyword. Since indexes are visible by default I chucked them all out. Then I got an error that some of his prim keys were set to null. I assumed that was by accident and set them all to "NOT NULL". I proceeded then to run the script, and got no errors, so I assumed everything was fine. He had told me he recently populated the tables, but it doesn't look like he did. I mean, I'm not certain that he did but he seems to have the columns set up nicely at the very least. When I ran the code, I inspected the tables but there were no tables listed. I am not sure where to go from here. I'll attach the code in question. If anyone can point me in the right direction, I'd be grateful.

-- Tue Nov 24 20:45:34 2020
-- Model: New Model    Version: 1.0
-- MySQL Workbench Forward Engineering

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='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------

-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ;
USE `mydb` ;

-- -----------------------------------------------------
-- Table `mydb`.`species`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`species` (
  `species_id` INT NOT NULL,
  `species_name` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`species_id`))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`animals`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`animals` (
  `animal_id` INT NOT NULL,
  `species_id` INT NOT NULL,
  `animal_name` VARCHAR(45) NOT NULL,
  `price` DECIMAL(8,2) NOT NULL,
  `date_arived` DATETIME not NULL,
  `quantity` INT NOT NULL,
  PRIMARY KEY (`animal_id`),
  INDEX `species_id_fk_idx` (`species_id` ASC),
  CONSTRAINT `species_id_fk`
    FOREIGN KEY (`species_id`)
    REFERENCES `mydb`.`species` (`species_id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`distributors`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`distributors` (
  `distributor_id` INT NOT NULL,
  `distributor_email` VARCHAR(255) NOT NULL,
  `distributor_name` VARCHAR(45) NOT NULL,
  `distributor_address` VARCHAR(45) NOT NULL,
  `distributor_phone` VARCHAR(15) NOT NULL,
  PRIMARY KEY (`distributor_id`))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`orders`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`orders` (
  `order_number` INT not NULL,
  `distributor_id` INT NOT NULL,
  `order_date` DATETIME not NULL,
  `arival_date` DATETIME not NULL,
  PRIMARY KEY (`order_number`),
  INDEX `distributor_id_fk_idx` (`distributor_id` ASC),
  CONSTRAINT `distributor_id_fk`
    FOREIGN KEY (`distributor_id`)
    REFERENCES `mydb`.`distributors` (`distributor_id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`invoice`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`invoice` (
  `invoice_id` INT NOT NULL,
  `order_number` INT NOT NULL,
  `animal_id` INT NOT NULL,
  `animal_price` DECIMAL(8,2) NOT NULL,
  `quantity` INT NOT NULL,
  PRIMARY KEY (`invoice_id`),
  INDEX `order_number_fk_idx` (`order_number` ASC),
  INDEX `animal_id_fk_idx` (`animal_id` ASC),
  CONSTRAINT `order_number_fk`
    FOREIGN KEY (`order_number`)
    REFERENCES `mydb`.`orders` (`order_number`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `animal_id_fk`
    FOREIGN KEY (`animal_id`)
    REFERENCES `mydb`.`animals` (`animal_id`)
    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;
0

There are 0 best solutions below