We installed the MySQL database on a Windows platform few days ago.
Now we’ll do something to the database. Let me show you how to create a new schema, and tables.
Create Schema
Launch MySQL Workbench 5.2 CE
Edit Table Data
Choose Stored Connection, you should see only one for now. Next.
For now, we cannot add the schema through this wizard, let’s pick test first, then Finish.
The SQL Editor appeared.
Right click on schema test, and choose Create Schema
Give the name of the schema, in my case is stock_schema, then Apply
The sql statement is displayed, then Apply.
The SQL script was successfully applied to the database, then Finish.
Create Table
You’ll see a new schema appeared in the left, close the create schema window by click on the X
Now, we need to create a table. Right click on the Tables(Expand the arrow of your schema, then you’ll see it) , then Create Table…
Give the table name and the column name, for this column (Stock_Info_ID) I want a number generated by the database, so I checked the Auto Increment. Please do NOT Apply yet.
Scroll down a little bit, then you can add another column here.This column I’m putting the Stock_Code and it’s Unique and Not null. Then Apply.
Again, the SQL Statement appeared. Apply to continue.
Finish
You’ll see one table under Tables
Now let’s put some data in the table. Right click on your table and then Edit Table Data.
Because the Stock_Info_ID is Auto Increment, so I just put the Stock_Code and then Apply.
The SQL Statement appeared again, then Apply.
The script was successfully applied, then Finish.
You’ll see the Stock_Info_ID was filled automatically.
Summary
Now we’ve have a new schema and a new table under this schema. Next time I’ll create another table put these two tables into a view. See you.