Sie sind auf Seite 1von 5

BMI 5300 Introduction to Biomedical Informatics

Module 9: Manually Creating a Table and Adding Data

Background
Until now you have been working with a single table to answer questions. The database and
table structure were defined for you.

Now you are going to learn how to modify the structure of the database by adding another table
to store specific data about Providers.

Preparation
Complete the SQL homework tutorials for this week before attempting this assignment.

Do the following exercises


1. Start MySQL Workbench
a. You should see a list of MySQL Connections similar to the image below.

Notes:
1. Your button may say “Local instance” instead of “primary”. That’s fine.
2. The numbers on your button may be different; that’s fine too.
3. If your primary button has disappeared, watch the video in Canvas that shows
how to recreate it. The link is in Module 4 on the M4: SQL Frequently Asked
Questions page.

b. Click the Primary button


c. The SQL window will open. Type your statements in the middle empty area, and then
click the lightning bolt to run them.

Rev.3/08/17 Page 1 of 5
2. If your Assignment schema (lower left corner) is not bolded, double-click it to make it
active (bold).
3. Create a table for provider data using SQL

The columns you need are:


DrIDNumber
DrFirstName
DrLastName
DrSpecialty
DrPhone

 Name your table Providers


 Set the DrIDNumber to be integer, 20 digits long, and as the primary key
 Set all the other columns to be varchar and 50 characters.

To run your command, highlight the line you typed and then click the yellow lightning
bolt on the toolbar.

Paste your SQL statement here:

4. Check your database structure using SQL


Paste your SQL statement here:

Tip: you can explore the Columns, Keys, and DDL tabs to compare the query you entered
earlier with the database structure that the query created.

Rev.3/08/17 Page 2 of 5
Add some providers into your Providers table
Now that you have a Providers table, you need to put some physicians and nurses into it. Note
that there are multiple ways to get data into a database table; this way will show you how to
enter a few records manually.

5. Enter the following provider records into your Providers table:

DrIDNumber DrFirstName DrLastName DrSpecialty DrPhone


75623 Loren Morgan Nephrology 713-555-3465
24852 Frank Wagoner Obstetrics 713-555-3572
23475 Mary Walkington Dermatology 713-555-3274

Paste your SQL statement(s) here:

Note: Your results pane will be empty; this is because it is inserting data into the table, not
displaying the results of a SELECT query. Once you run a SELECT, you’ll see the results panel as
normal.

6. Display all the information on your Providers from your Providers table:

Paste your SQL statement here:

Tip: If you receive an error code 1146, check the spelling and case of your Providers
table.

Rev.3/08/17 Page 3 of 5
7. Take a screen shot of your displayed provider records along with the syntax.
a. On the VirtualBox menu bar, click View Take Screenshot
b. In Save As: enter yourlastname_yourfirstname_m9
c. In Where: choose your Desktop.
d. Click Save.

e. This is an example of what to turn in (I have masked the commands).


Note: Blurry images or photographs of the screen such as with a cellphone or camera
will earn a grade of 0 (zero).

Make sure your display shows all three panels: the command panel at the top, the
output in the middle, and the messages at the bottom. You won’t be able to show
all the SQL statements and that is OK – just make sure that the three provider
records show completely.

Rev.3/08/17 Page 4 of 5
8. Name your file yourlastname_yourfirstname_m9 and turn in the screen shot to the
assignment in Canvas. You do not need to turn in the SQL statements, just the screenshot
of the displayed provider records in your database.

Summary of what you did in this assignment


Entering a few records like this works, but it is tedious and time-consuming. What do you do
if you have thousands or millions of records, like basic patient information? That’s what
you’ll see next week.

Rev.3/08/17 Page 5 of 5

Das könnte Ihnen auch gefallen