Reputation: 35
i'm getting the #1103 - Incorrect table name 'employee' i searched the mistake code, and i found a question similar to this. they have suggested to delete the white charachters, but I don't have these charachters what can be the mistake?
the code is below, and I already have an employee table which is created before.
create table approve(
employee.ID char(8),
customer.ID char(8),
loanID char(8) primary key,
foreign key(employee.ID) references employee(ID),
foreign key(customer.ID) references customer(ID)
)
Upvotes: 0
Views: 8661
Reputation: 180927
You can't use periods (unquoted) in your field names since it's used for other purposes (for example table/field delimiter) in SQL. You could instead for example use underscore.
create table approve(
employee_ID char(8),
customer_ID char(8),
loanID char(8) primary key,
foreign key(employee_ID) references employee(ID),
foreign key(customer_ID) references customer(ID)
)
If you really want to use periods which I strongly recommend you don't, you need to quote your table names using the RDBMS' way of quoting, for example in MySQL with backticks;
create table approve(
`employee.ID` char(8),
`customer.ID` char(8),
loanID char(8) primary key,
foreign key(`employee.ID`) references employee(ID),
foreign key(`customer.ID`) references customer(ID)
);
Of course, then you'd end up needing to quote your table name everywhere, and some tools that do not display the quoting may make things look really strange.
Upvotes: 3