SQL Your Life
This blogger focus on any database not Oracle.
2012年3月3日 星期六
This Site Will Stop for a While
2012年2月21日 星期二
Creating Schemas and Tables
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.
2012年2月20日 星期一
Installing MySQL on Windows
This blog SQL Your Life, is mainly focus any database but not Oracle. Today, I’m going to introduce you how to install MySQL on Windows. If you like my blog, you may share it on twitter or facebook via my blog tools.
Download
Go to url http://dev.mysql.com/downloads/, press the Download button
And in the next page, Download again.
You can either register an new account or just say “No thanks, just take me to the downloads!”
Choose the closest mirror site to you, and save the file in the folder you like.
Installation
Run the mysql-installer-5.n.nn.n.msi (n is the version number, not sure which version will it be when you’re browsing this blog)
.Net Framework 4.0
This message tells us that we need to install the .Net Framework 4.0.
Let’s go to http://go.microsoft.com/fwlink/?LinkId=181012, and click on Download to download the framework.
You may either Run or Save the file.
Check the checkbox then Install.
The installation is processing…
Finish to complete the installation of .Net Framework 4.0
MySQL
Run the mysql-installer-5.n.nn.n.msi again.
Choose Install MySQL Products.
Check the I accept the license terms, then Next.
Check the Skip the check for updates, then Next.
Choose Developer Default as Setup Type, and Next.
Execute and it will launch the installer of Visual C++ 2010 runtime installer.
Check the checkbox, and then Install.
Finish to complete the installation of Visual C++ 2010 runtime.
Note that the green check appeared in the Microsoft Visual C++ 2010, then Next.
Review the products will be installed, then Execute
Installing…
All install success, then Next.
Configuration
Next to do the configuration.
Choose Developer Machine, then Next.
Give the password of MySQL Root, then Next.
Next to continue.
Installation Complete, Finish to continue
The MySQL Workbench will be launched.
What’s Next
That’s all for the installation. Next we’ll do something to the database.
See you next time.