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: employee_id is our key field for this table. It should be an integer and auto increment. employee_name is a required field to store names. job_id is an integer that refers to the job_id field in the jobs table. It is also required. (This will require an additional hire_date is a date. It should default to the day we create the record.
CREATE TABLE employees (
employee_id INT AUTO_INCREMENT PRIMARY KEY,
employee_name VARCHAR(255) NOT NULL,
job_id INT NOT NULL,
hire_date DATE DEFAULT CURRENT_DATE,
FOREIGN KEY (job_id) REFERENCES job_titles(job_id)
);
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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!