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)? -
16.2 -
116.2 -
16.21 -
1116.2 -
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. -
ssn -
state -
city -
phone_number -
zip -
last_name -
first_name -
middle_name -
salary -
hourly_pay_rate -
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. -
ssn -
state -
city -
phone_number -
zip -
last_name -
first_name -
middle_name -
salary -
hourly_pay_rate -
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; | |