Workshop

Team-Fly    

 
Sams Teach Yourself SQL in 24 Hours, Third Edition
By Ronald R. Plew, Ryan K. Stephens
Table of Contents
Hour  2.  Defining Data Structures


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. You may refer to Appendix C,"Answers to Quizzes and Exercises," for answers.

Quiz

1:

True or false: An individual's Social Security number can be any of the following data types: constant-length character, varying-length character, numeric.

2:

True or false: The scale of a numeric value is the total length allowed for values.

3:

Do all implementations use the same data types?

4:

What are the precision and scale of the following?

 DECIMAL(4,2)  DECIMAL(10,2) DECIMAL(14,1) 
5:

Which numbers could be inserted into a column whose data type is DECIMAL(4,1)?

  1. 16.2

  2. 116.2

  3. 16.21

  4. 1116.2

  5. 1116.21

6:

What is data?

Exercises

1:

Take the following column titles, assign them to a data type, and decide on the proper length.

  1. ssn

  2. state

  3. city

  4. phone_number

  5. zip

  6. last_name

  7. first_name

  8. middle_name

  9. salary

  10. hourly_pay_rate

  11. date_hired

2:

Take the same column titles and decide whether they should be NULL or NOT NULL, realizing that in some cases where a column would normally be NOT NULL, the column could be NULL or vice versa, depending on the application.

  1. ssn

  2. state

  3. city

  4. phone_number

  5. zip

  6. last_name

  7. first_name

  8. middle_name

  9. salary

  10. hourly_pay_rate

  11. date_hired

3:

We are going to set up a database in MySQL to use for the subsequent hours in this book. From Windows Explorer, go to the folder where you installed MySQL on your computer. Double-click on the bin folder, and then double click on the executable file called mysql.exe. If you receive an error stating that the server could not be found, first execute winmysqladmin.exe from the bin folder, and then enter a username and password. After the server is started, execute mysql.exe from the bin folder.

At the mysql> command prompt, enter the following command to create a database to use for this book's exercises:

 create database learnsql; 

Be sure to press the Enter key on your keyboard after entering the command. For all subsequent hands-on exercises in this book, you will double-click on the mysql.exe executable, and then enter the following command to use the database you just created:

 use learnsql; 

Team-Fly    
Top
 


Sams Teach Yourself SQL in 24 Hours
Sams Teach Yourself SQL in 24 Hours (5th Edition) (Sams Teach Yourself -- Hours)
ISBN: 0672335417
EAN: 2147483647
Year: 2002
Pages: 275

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net