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 7078463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:33:03+00:00 2026-05-28T06:33:03+00:00

I am working few days with my project and I stuck on phpmyadmin sql.

  • 0

I am working few days with my project and I stuck on phpmyadmin sql.
I create in workbench ERR Diagram which looks like:
enter image description here

And the code to paste into sql query is:

    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 `nieruchomosci` ;
CREATE SCHEMA IF NOT EXISTS `nieruchomosci` DEFAULT CHARACTER SET utf8 ;
USE `nieruchomosci` ;

-- -----------------------------------------------------
-- Table `nieruchomosci`.`wojewodztwa`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `nieruchomosci`.`wojewodztwa` ;

CREATE  TABLE IF NOT EXISTS `nieruchomosci`.`wojewodztwa` (
  `id_wojewodztwa` INT NULL AUTO_INCREMENT ,
  `nazwa` VARCHAR(145) NULL ,
  PRIMARY KEY (`id_wojewodztwa`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `nieruchomosci`.`material`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `nieruchomosci`.`material` ;

CREATE  TABLE IF NOT EXISTS `nieruchomosci`.`material` (
  `id_material` INT NULL AUTO_INCREMENT ,
  `typ` VARCHAR(45) NULL ,
  PRIMARY KEY (`id_material`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `nieruchomosci`.`szczegoly`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `nieruchomosci`.`szczegoly` ;

CREATE  TABLE IF NOT EXISTS `nieruchomosci`.`szczegoly` (
  `id_szczegoly` INT NULL ,
  `typ_nabytku` VARCHAR(45) NULL ,
  `nr_budynku` INT NULL ,
  `nr_lokalu` INT NULL ,
  `pokoje` INT NULL ,
  `powierzchnia_mieszkania` INT NULL ,
  `powierzchnia_domu` INT NULL ,
  `stan_b` INT NULL ,
  `stan_l` INT NULL ,
  `winda` VARCHAR(45) NULL ,
  `garaz` VARCHAR(45) NULL ,
  `osiedle` VARCHAR(45) NULL ,
  `telefon` VARCHAR(45) NULL ,
  `internet` VARCHAR(45) NULL ,
  `tv` VARCHAR(45) NULL ,
  `domofon` VARCHAR(45) NULL ,
  `tereny` VARCHAR(45) NULL ,
  `plac_zabaw` VARCHAR(45) NULL ,
  `sport` VARCHAR(45) NULL ,
  `kino` VARCHAR(45) NULL ,
  `basen` VARCHAR(45) NULL ,
  PRIMARY KEY (`id_szczegoly`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `nieruchomosci`.`ogloszenie`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `nieruchomosci`.`ogloszenie` ;

CREATE  TABLE IF NOT EXISTS `nieruchomosci`.`ogloszenie` (
  `id_ogloszenie` INT NULL AUTO_INCREMENT ,
  `rok` INT NULL ,
  `pietro` INT NULL ,
  `ile_pieter` INT NULL ,
  `cena` INT NULL ,
  `typ_oferty` INT NULL ,
  `id_adres` INT NULL ,
  `id_material` INT NULL ,
  PRIMARY KEY (`id_ogloszenie`) ,
  INDEX `fk_ogloszenie_material1` (`id_material` ASC) ,
  CONSTRAINT `fk_ogloszenie_material1`
    FOREIGN KEY (`id_material` )
    REFERENCES `nieruchomosci`.`material` (`id_material` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_ogloszenie_szczegoly1`
    FOREIGN KEY (`id_ogloszenie` )
    REFERENCES `nieruchomosci`.`szczegoly` (`id_szczegoly` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `nieruchomosci`.`adres`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `nieruchomosci`.`adres` ;

CREATE  TABLE IF NOT EXISTS `nieruchomosci`.`adres` (
  `id_adres` INT NULL AUTO_INCREMENT ,
  `ulica` VARCHAR(45) NULL ,
  `miasto` VARCHAR(45) NULL ,
  `powiat` VARCHAR(45) NULL ,
  `id_wojewodztwa` INT NULL ,
  PRIMARY KEY (`id_adres`) ,
  INDEX `fk_adres_wojewodztwa` (`id_wojewodztwa` ASC) ,
  CONSTRAINT `fk_adres_wojewodztwa`
    FOREIGN KEY (`id_wojewodztwa` )
    REFERENCES `nieruchomosci`.`wojewodztwa` (`id_wojewodztwa` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_adres_ogloszenie1`
    FOREIGN KEY (`id_adres` )
    REFERENCES `nieruchomosci`.`ogloszenie` (`id_adres` )
    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;

Adres means Address
Ogloszenie means Advertistment
Wojewodztwa means Province
Material means Material
Szczegoly means Details

This simple project is about advertistment which sells houses.
My error is

Executing SQL script in server

ERROR: Error 1005: Can't create table 'nieruchomosci.adres' (errno: 150)

I am total yellow in sql, where did I make mistake?

  • 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-28T06:33:03+00:00Added an answer on May 28, 2026 at 6:33 am

    I think you reference the foreign key at the wrong position.
    Instead of having the following in the definition of adres

    CONSTRAINT `fk_adres_ogloszenie1`
    FOREIGN KEY (`id_adres` )
    REFERENCES `nieruchomosci`.`ogloszenie` (`id_adres` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
    

    You should put this in the definition of the ogloszenie table.

    Hope that helps.

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

Sidebar

Related Questions

It looks like there a few working solutions for using custom true type fonts
I have been working on a project for a few days now and have
I've been working on this project for a few days and I really haven't
I have been working with Mahout in the past few days trying to create
Over the past few days I have been trying to create/run a project in
I've been working on this for a few days now, and I've found several
Just started working with Mercurial a few days ago and there's something I don't
I have been working with the jQuery Grid the past few days and one
I've been asking a question or two over the past few days of working
I have a java project that I'm working on which was working until a

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.