SQL Extensions   «Prev  Next»

Adding or Modifying Column - Exercise

Course project: Adding and modifying columns

Objective Add a column and change another column in an existing table.

Exercise scoring

This auto-scored exercise is worth 20 points. When you have completed the simulation, click the Submit button to receive full credit and to review the exercise solution.

Instructions

In the following simulation exercise, you will be asked to perform a task or set of tasks you have learned in the previous lesson. You will be working with the course project, a pet store called House-O-Pets. The instructions will tell you what you need to do at each step but will not tell you exactly how.
There is a correct way to proceed through each screen of the simulation by typing the code in the field requested. If at any point you find that you cannot proceed, go back and re-read the lesson and then navigate through the simulation again.
1) Text 1 2) Text 2 3) Text 3 4) Text 4

  1. This shows you the columns in the EMPLOYEE table as it is now. Your first task is to add a new column at the end of the table. The column is named BIRTH_DATE. It can be null and has no constraints. Type in the command and execute it by pressing ENTER.
  2. Syntax error
  3. ALTER TABLE EMPLOYEE ADD (BIRTH_DATE DATE);
  4. Finish the statement with a semi-colon so it executes immediately.
  1. Change the LASTNAME column to have a default value of 'LASTNAMEHERE'. Type in the command on two lines (refer to the sample syntax in the lesson) and execute it by pressing ENTER.
  2. ALTER TABLE EMPLOYEE
  3. End the first line with the word EMPLOYEE. Finish the statement with a semicolon so it executes immediately.
  4. MODIFY (LASTNAME DEFAULT 'LASTNAMEHERE');
  5. End the first line with the word EMPLOYEE. Finish the statement with a semicolon so it executes immediately.