Creating a data table with T-SQL statements

Source: Internet
Author: User

Another way to create a table is to enter code to create it.

After the address that needs to be manipulated on the connection, select the database from which to create the query, and the following interface appears:

Enter the code here to create the table:

Create table for creating tables;

Primary key is the main key;

Not NULL is non-null;

Auto_increment for self-growth columns;

Foreign key is a foreign key;

References is a reference.

Create a data table with a foreign key:

#民族Create TableMinzu (XuhaointAuto_incrementPrimary Key, #民族序号 Minzuvarchar( -) not NULL#民族); #用户Create TableYonghu (Shunxuint Primary Key, #用户顺序 namevarchar( -) not NULL, #用户名ageint, #年龄 Minzuint, #民族Foreign Key(Minzu)ReferencesMinzu (Xuhao))

To create a data table notation:

1. Create table+ table name (column name + Type + properties of the column such as primary key, non-null, column name + type + attribute)

2. The contents of the created table are written in (), in the order of the columns;

3. Each column is written with "," separated, and the last column is not added ",";

4. After writing a statement, add ";" Separated

5. The main table should be written on the top of the table;

6. If the column type is a character or string must be appended (length) after char (character) or varchar (string);

The 7.MySQL is commented in the following way: # + Comment Content

Click to run if the following page appears, the creation succeeds and the refresh within the table is displayed.

Creating a data table with T-SQL statements

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.