1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Failed to open the referenced table

Discussão em 'Outras Linguagens' iniciado por Stack, Setembro 10, 2024.

  1. Stack

    Stack Membro Participativo

    I am new with SQL and I am not entirely sure why I am getting the error: ERROR 1824 (HY000) at line 5: Failed to open the referenced table 'products' Operation failed with exitcode 1

    Here is my code

    drop database if exists cc;
    create database cc /*!40100 default character set utf8 */;
    use cc;

    create table Customers(
    CustomerID int not null,
    FirstName varchar(255),
    LastName varchar(255),
    address varchar(255),
    phoneNO varchar(11),
    prodID int,
    quantity int,
    primary key (CustomerID),
    foreign key (prodID) references Products(itemID)
    );

    create table Employees(
    EmployeeID int not null,
    FirstName varchar(255),
    LastName varchar(255),
    address varchar(255),
    phoneNO varchar(11),
    ManagerID int not null,
    primary key (EmployeeID),
    foreign key (managerID) references Managers(mgrID)
    );

    create table Managers(
    mgrID int not null,
    salary float,
    MaxSupervisingCapacity int,
    foreign key (mgrID) references Employees(EmployeeID),
    primary key (mgrID)
    );

    Continue reading...

Compartilhe esta Página