Designing the department table
4. Click Save. You??™ll be shown a page with many details about the table you just created. There, you can see
the SQL code that was generated to create the table and various other details, such as confirmation that an
index was indeed created automatically for the primary key field.
5. Now, you can add some sample data in the department table. Click the SQL tab, type the following query,
and then click Go to execute it. The command should add three records to the department table you created
earlier.
-- Populate department table
INSERT INTO `department` (`department_id`, `name`, `description`) VALUES
(1, 'Regional', 'Proud of your country? Wear a T-shirt with a national
symbol stamp!'),
(2, 'Nature', 'Find beautiful T-shirts with animals and flowers in our
Nature department!'),
(3, 'Seasonal', 'Each time of the year has a special flavor. Our seasonal
T-shirts express traditional symbols using unique postal stamp pictures.');
How It Works: Creating MySQL Data Tables
You have just created your first database table! You also filled the table with some data using the INSERT SQL
command, which we use to add records to a database table. You??™ll learn more about it soon.
As you can see, as soon as you have a clear idea about the structure of a table, it??™s relatively easy to use the
phpMyAdmin web interface to create it into your database.
Pages:
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154