Home > Articles

  • Print
  • + Share This
This chapter is from the book


The following workshop is composed of a series of quiz questions and practical exercises. The quiz questions are designed to test your overall understanding of the current material. The practical exercises are intended to afford you the opportunity to apply the concepts discussed during the current hour, as well as build upon the knowledge acquired in previous hours of study. Please take time to complete the quiz questions and exercises before continuing. Refer to Appendix C, "Answers to Quizzes and Exercises," for answers.


  1. Will the following CREATE TABLE statement work? If not, what needs to be done to correct the problem(s)?

  2. Create table EMPLOYEE_TABLE as:

      ( ssn       number(9)    not null,
      last_name    varchar2(20)  not null,
      first_name    varchar2(20)  not null,
      middle_name   varchar2(20)  not null,
      st address    varchar2(30)  not null,
      city       char(20)    not null,
      state      char2)     not null,
      zip       number(4)    not null,
      date hired    date);
  3. Can you drop a column from a table?

  4. What happens if you do not include the STORAGE clause in the CREATE TABLE statement?


  1. Navigate to the folder on your computer where you installed MySQL. Navigate (double-click on) the bin folder, and then double-click on the mysql.exe executable to invoke MySQL.

  2. At the mysql> command prompt, enter the following command to tell MySQL that you want to use the database you created previously:

  3. use learnsql;
  4. Now, go to Appendix D, "CREATE TABLE Statements for Book Examples," to get the DDL for the tables used in this book. At the mysql> prompt, enter each CREATE TABLE statement. Be sure to include a semicolon at the end of each CREATE TABLE statement. The tables that you create will be used throughout the book.

  5. At the mysql> prompt, enter the following command to get a list of your tables:

  6. show tables;
  7. At the mysql> prompt, use the DESCRIBE command (desc for short) to list the columns and their attributes for each one of the tables you created. For example:
    describe employee_tbl;
    describe employee_pay_tbl;
  8. If you have any errors or typos, simply recreate the appropriate table(s). If the table was successfully created, but has typos (perhaps you did not properly define a column or forgot a column), drop the table, and issue the CREATE TABLE command again. The syntax of the DROP TABLE command is as follows:
    drop table orders_tbl;
  • + Share This
  • 🔖 Save To Your Account