To illustrate editing you first need to create a second table just like you did the first one. This is what to do:
- click on the database name (intsql) on the left to go to the list of tables
- under Create table call the table secondtable and have 4 columns (fields) - press Go
- make sure the database engine is InnoDB
- create the four fields:
- trackID, INT, UNSIGNED, PRIMARY, Auto-increment
- cdReference, INT, UNSIGNED
- trackOrder, TINYINT, UNSIGNED
- trackTitle, INT
- do not press Save or Go yet
If you spotted a mistake in that well done but ignore it for now. If you didn't look for it!
Depending on the version of PHPMyAdmin you might be able to preview the SQL code which is about to be sent to the server. If you have a preview on the screen click on Preview SQL. What you see should remind you of what you did in the Beginner tutorial to create a new SQL table. PHPMyAdmin is clever but not mysterious. You click on things and it builds SQL queries to do what you want done. At all stages it lets you view and even edit the SQL just like you did to create and edit tables before. The screenshot here shows the code so if you could not Preview look here.
Now press Close and then Save.
We need to fix that mistake in secondtable now. Click on the pencil or the word Change in the Action column for trackTitle
- change the track title from INT to VARCHAR length 50 as most music tracks are labelled by words not just numbers!
- press Save
Feel free to create and fiddle with more tables but do not change these two. Some considerations:
- when choosing types hover over the entry in the drop down (or do a Web search for SQL data types to see which ones to use - the smallest possible will be fastest)
- some older SQL servers seem to struggle with camelCase so perhaps keep database and table names as lower case for now (fields names in camelCase are fine)
- table names should technically be singular (product not products) but either works
- do not use spaces or special characters in any names (databases, tables or fields)
- make names clear (not like my two which are rubbish as they do not describe what is in them)