I cant crack insert table exercise 1 where im getting an error because im trying to insert 3 values into title which has four columns
insert into titles(
emp_no,
title,
from_date)
values(
999903,
'Senior Engineer',
'1997-10-01'); But there are four columns in titles: emp_no,
title,
from_dateto_date many thanks, dean
emp_no,
title,
from_date)
values(
999903,
'Senior Engineer',
'1997-10-01'); But there are four columns in titles: emp_no,
title,
from_dateto_date many thanks, dean
3 answers ( 0 marked as helpful)
Hi dean!
Thanks for reaching out and please accept my apology for the delayed response.
Please stick to our general request to execute all code you see in the lectures and the exercises, in the given order. Doing this will prevent you from encountering some errors, such as this one – Error Code: 1452.
REASON FOR THE ERROR:
This error appears if you have already created another table, employees, where you have missed inserting data about the individual with id 999903. The relationship you have established between employees and dept_emp requires that you first insert a record in employees, and then insert a (related) record in dept_emp.
ON DELETE CASCADE means that if you remove record 999903 from employees, record 999903 will automatically be removed from dept_emp as well.
In brief, make sure the relationship between employees and dept_emp is valid and 999903 exists in employees so that you don’t get the same error the next time you try inserting 999903 in dept_emp.
SOLUTION: As explained in the article preceding this video, double-check if you’ve first inserted information about employee number 999903 in the employees table. Only then you should proceed with inserting information in the titles and dept_emp tables.
Hope this helps.
Best,
Martin
Best,
Martin
Show databases;
Use customers;
Create table customers
(
Customer_ID INT auto_increment,
First_Name Varchar(10),
Last_Name Varchar(10),
Address Varchar(150),
City Varchar(20),
Post_Code Varchar(8),
Country Varchar(7),
Primary Key (Customer_ID)
);
Drop table customer;
Use customers;
describe customers;
Insert into customers(Customer_ID,First_Name,Last_Name,Address,City,Post_Code,Country) Value ('18','Harry','Potter','67 Atlanta','Nantes','44000','France');
Hi!
Thanks for reaching out.
What is the question exactly, please? Is it that you are referring to a "customers" database while during the course we've only created "sales" that is relevant to the "customers" table?
Other than that, your code for table creation is correct.
Hope this helps.
Best,
Martin