Tip:
Highlight text to annotate it
X
Hello and welcome to the second video in phpMyAdmin for our classes at LBCC. If you haven't already
watched the first video, I recommend that you stop this video and watch that one before
proceeding with this one so we are all at the same place.
We're going to talk today about how to add data to our database table. For those of you
again, if you forgot how to get to phpMyAdmin, go to the following url: http://wcbis.lbcc.edu
and login with your username and password. Your username is your last name followed by
an underscore and your first initial, all in lowercase. Your password is your 7-digit
student id number. Click GO.
Once you've logged in you are taken to the main page with information about the web server
and sql server. You want to select the table under your last name. We'll select the database
table we created a homework 4 database, so let's choose that one.
We had created our USER table in our last video. Note that if you mouse over the icons,
we cannot click on the BROWSE icon because there is no data in the table yet. The next
icon is structure and you can click on that to see the database field name and data types.
So to insert data into your database, you're going to click on the INSERT tab and we're
going to do this the easy way at first. We're just going to start inserting some ficticious
data. So let's enter data for two people. We're not going to enter data for the first
field, user_id, because that data will be automatically added by the server since we
identified it as an auto increment field. The second line corresponds with the first_name
field. Let's go ahead and put our own name in here, our first and last name and email
address. Go ahead and add information for a second person.
I will warn you that if you select to add more rows at the bottom, before you have saved
your data, you will lose all of the data you just input. So only select that if you have
NOT entered data yet. Let's click GO. You'll see our SQL statement has run - the green
box at the top says two rows were inserted. If you click the BROWSE tab, you'll see that
the information we just entered into the system is there.
Let's go ahead and enter three more rows. We have boxes for two, so let's select FIVE
from the drop down box. Let's put in three more rows -- you can press pause and take
your time to fill these out if you would like.
Typing Typing
Typing
Since we are only going to enter three, we will leave two boxes empty. Click GO and you'll
see again that three rows were inserted. If you click browse, I always recommend that
you click browse and verify that your information has been entered. You'll see data for user_id
1 through 5. Now if you had wanted to go and select a different table, you can click on
the name of the database or through the breadcrumbs at the top of the page - server, database
name, and table.
If there was another table in here, then you could navigate through the other tables and
insert more rows into another table. Your icons are browse which shows you the data
that is in the table, structure which allows you to edit the field names and types, search
allows you to retrieve data from the table, insert what we were just doing and empty.
If you click empty, ever single thing in the table will disappear. DROP will take the entire
structure and data and delete it. So don't use those last two. You are really only going
to be using browse, structure and insert.
Now if you wanted to run SQL statements on this database, just click the SQL box. And
let's just do SELECT * from USER; click Go. And here we go - we just got everything returned
from that table. If we wanted to run something else, SELECT * FROM USER WHERE user_id = 3;
we'll get information returned from that query.
That was a quick introduction on how to insert data into our tables and how to run SQL statements.
Again, you can also add data to our tables by using the SQL tab - we will be looking
at that next week! Okay, good luck!