Always use a SQL SERVER database; The most recent project using my SQL feels a bit out of the way. But it's a lot better when you're familiar.
After MY SQL installation there will be a management tool MySQL Workbench feel not very good, database backup import always have some strange problems, later from the download SQLyog feel more cool.
The following separately describes the use of the SQLYOG management tool and SQL statements to build a database table.
I. Using SQLYOG to build a table
In fact, using the SQLyog tool to build the database and SQL Server is not the difference between the visualization, just click the corresponding button, fill in the content;
The steps are as follows:
1. After starting SQLyog, click File-New connection; connect MySQL server
2. Select Server Right-click Create Database
3, select the corresponding library click Create TABLE
4, fill in the corresponding field information can be
5. Close and save after completion
At this end a simple database has been built.
II. using SQL statements to build a database table
1. Creating a Database
CREATE DATABASE Test
2. Create a user-type data table
CREATE TABLE ' usertype ' (
' ID ' INT (one) not NULL auto_increment,
' TypeName ' VARCHAR ($) DEFAULT NULL COMMENT ' user type name ',
' Typedescript ' VARCHAR ($) DEFAULT NULL COMMENT ' user type description ',
PRIMARY KEY (' ID ')
)
3. Create a user information data sheet
CREATE TABLE ' UserInfo ' (
' ID ' INT (one) not NULL auto_increment COMMENT ' self-increment primary key ',
' UserName ' VARCHAR ($) DEFAULT NULL COMMENT ' user name ',
' Userlogin ' VARCHAR ($) DEFAULT NULL COMMENT ' user login name ',
' UserPassword ' VARCHAR ($) DEFAULT NULL COMMENT ' password ',
' UserEmail ' VARCHAR (+) DEFAULT NULL COMMENT ' e-mail ',
' Usertype ' INT (one) DEFAULT NULL COMMENT ' user type ',
PRIMARY KEY (' ID '),
KEY ' usertype ' (' usertype '),
CONSTRAINT ' Userinfo_ibfk_1 ' FOREIGN KEY (' usertype ') REFERENCES ' usertype ' (' ID ')
)
MySQL Build database Build table