Question: Next, let s create a second table to store information about our employees. Note that to create a foreign key, we need to use the
Next, lets create a second table to store information about our employees. Note that to create a foreign key, we need to use the MySQL syntax meaning you will have to declare the foreign key constraint on its own line. Create a table with the following fields with the listed constraints: employeeid is our key field for this table. It should be an integer and auto increment. employeename is a required field to store names. jobid is an integer that refers to the jobid field in the jobs table. It is also required. This will require an additional hiredate is a date. It should default to the day we create the record.
CREATE TABLE employees
employeeid INT AUTOINCREMENT PRIMARY KEY,
employeename VARCHAR NOT NULL,
jobid INT NOT NULL,
hiredate DATE DEFAULT CURRENTDATE,
FOREIGN KEY jobid REFERENCES jobtitlesjobid
;
I keep getting an error message with the current date next to hire date. I do not know how to fix that problem.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
