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

  • SEARCH
  • Home
  • 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 8330363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:06:02+00:00 2026-06-09T02:06:02+00:00

This is my script to create the database. Thanks in advance for the help

  • 0

This is my script to create the database. Thanks in advance for the help everybody .

The four tables I am inserting data into when the error occurs are :

  1. asset
  2. asset_details
  3. location
  4. invoice

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';

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

-- -----------------------------------------------------
-- Table `inventory1`.`department`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `inventory1`.`department` ;

CREATE  TABLE IF NOT EXISTS `inventory1`.`department` (
  `department_id` INT NOT NULL ,
  `department_name` VARCHAR(45) NOT NULL ,
  `job_id` VARCHAR(45) NOT NULL ,
  PRIMARY KEY (`department_id`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `inventory1`.`employee`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `inventory1`.`employee` ;

CREATE  TABLE IF NOT EXISTS `inventory1`.`employee` (
  `employee_id` INT NULL ,
  `department_id` INT NULL ,
  `fname` VARCHAR(45) NULL ,
  `lname` VARCHAR(45) NULL ,
  `email` VARCHAR(45) NULL ,
  `phone_number` VARCHAR(45) NULL ,
  `hire_date` VARCHAR(45) NULL ,
  `job_id` VARCHAR(45) NULL ,
  `manager_id` VARCHAR(45) NULL ,
  PRIMARY KEY (`employee_id`) ,
  INDEX `department_id` (`department_id` ASC) ,
  CONSTRAINT `department_id`
    FOREIGN KEY (`department_id` )
    REFERENCES `inventory1`.`department` (`department_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `inventory1`.`invoice`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `inventory1`.`invoice` ;

CREATE  TABLE IF NOT EXISTS `inventory1`.`invoice` (
  `invoice_number` VARCHAR(25) NULL ,
  `invoice_date` INT UNSIGNED NULL ,
  `purchase_price` INT UNSIGNED NULL ,
  `quantity` INT UNSIGNED NULL ,
  `order_date` INT UNSIGNED NULL ,
  `vender` INT UNSIGNED NULL ,
  `warranty_end` DATE NULL ,
  `notes` VARCHAR(255) NULL ,
  `vender_name` VARCHAR(45) NULL ,
  PRIMARY KEY (`invoice_number`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `inventory1`.`assignment`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `inventory1`.`assignment` ;

CREATE  TABLE IF NOT EXISTS `inventory1`.`assignment` (
  `assignment_id` INT NOT NULL ,
  `assignment_status` VARCHAR(45) NOT NULL ,
  PRIMARY KEY (`assignment_id`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `inventory1`.`asset`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `inventory1`.`asset` ;

CREATE  TABLE IF NOT EXISTS `inventory1`.`asset` (
  `asset_tag` INT NOT NULL ,
  `cap_ex` VARCHAR(10) NULL ,
  `asset_type_id` INT NULL ,
  `invoice_number` VARCHAR(25) NULL ,
  `status_id` INT NULL ,
  PRIMARY KEY (`asset_tag`) ,
  INDEX `assignment_id` (`status_id` ASC) ,
  CONSTRAINT `invoice_number`
    FOREIGN KEY (`invoice_number` )
    REFERENCES `inventory1`.`invoice` (`invoice_number` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `assignment_id`
    FOREIGN KEY (`status_id` )
    REFERENCES `inventory1`.`assignment` (`assignment_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `inventory1`.`location`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `inventory1`.`location` ;

CREATE  TABLE IF NOT EXISTS `inventory1`.`location` (
  `location_id` INT NOT NULL ,
  `location_name` VARCHAR(45) NULL ,
  `rack` INT NULL ,
  `row` INT NULL ,
  `unit` INT NULL ,
  PRIMARY KEY (`location_id`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `inventory1`.`physical_asset`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `inventory1`.`physical_asset` ;

CREATE  TABLE IF NOT EXISTS `inventory1`.`physical_asset` (
  `physical_asset_id` INT NOT NULL ,
  `location_id` INT NOT NULL ,
  `employee_id` INT NOT NULL ,
  `physical_asset_name` VARCHAR(45) NOT NULL ,
  PRIMARY KEY (`physical_asset_id`) ,
  INDEX `location_id` (`location_id` ASC) ,
  INDEX `employee_id` (`employee_id` ASC) ,
  CONSTRAINT `location_id`
    FOREIGN KEY (`location_id` )
    REFERENCES `inventory1`.`location` (`location_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `employee_id`
    FOREIGN KEY (`employee_id` )
    REFERENCES `inventory1`.`employee` (`employee_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `inventory1`.`asset_details`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `inventory1`.`asset_details` ;

CREATE  TABLE IF NOT EXISTS `inventory1`.`asset_details` (
  `asset_type_id` INT NULL ,
  `asset-tag` INT NULL ,
  `asset_type` VARCHAR(45) NULL ,
  `physical_asset_id` INT NULL ,
  `manufacturer` VARCHAR(45) NULL ,
  `os` VARCHAR(45) NULL ,
  `os_version` VARCHAR(45) NULL ,
  `make` VARCHAR(45) NULL ,
  `model` VARCHAR(45) NULL ,
  `serial_number` VARCHAR(45) NULL ,
  `processor` VARCHAR(45) NULL ,
  `ram` VARCHAR(45) NULL ,
  `memory` VARCHAR(45) NULL ,
  `hdd` VARCHAR(45) NULL ,
  `host_name` VARCHAR(45) NULL ,
  `notes` VARCHAR(250) NULL ,
  PRIMARY KEY (`asset_type_id`) ,
  INDEX `physical_asset_id` (`physical_asset_id` ASC) ,
  INDEX `asset_tag` (`asset-tag` ASC) ,
  CONSTRAINT `physical_asset_id`
    FOREIGN KEY (`physical_asset_id` )
    REFERENCES `inventory1`.`physical_asset` (`physical_asset_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `asset_tag`
    FOREIGN KEY (`asset-tag` )
    REFERENCES `inventory1`.`asset` (`asset_tag` )
    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;
  • 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-06-09T02:06:05+00:00Added an answer on June 9, 2026 at 2:06 am

    You’ll need to be sure that you use AUTO_INCREMENT on your primary keys, otherwise it will try to make them all 0, which it can’t because primary keys have to be unique.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used this script to create a jQuery accordion. Check out the working jsFiddle
This is my SQL Script CREATE TABLE account_profile ( accnt_id int NOT NULL ,
I'm trying to run the following PowerShell script to create a local user. This
This is the first Python script I've tried to create. I'm reading a xml
I have a python script the runs this code: strpath = sudo svnadmin create
Some hosters let your script CREATE DATABASE, some do not, and require you to
I'm trying to store a create database script (a rather lengthy one) in the
I have this code in a .html.erb file: <script src=http://connect.facebook.net/en_US/all.js#xfbml=1></script> <script> FB.Event.subscribe('edge.create', function(response) {
I have a script which creates a user-defined object like this: obj = new
I bought this program that created a pretty nice imageuploader flash script however I

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.