MYSQL CREATE database table (delete, delete, insert)

Source: Internet
Author: User
Tags mysql create mysql create database

MySQL Create data table

The following information is required to create a MySQL data table:

    • Table name
    • table field Name
    • Define each table field
Grammar

The following is the general SQL syntax for creating MySQL data tables:

(column_name column_type); 

In the following example we will create a data table Tutorials_tbl in the tutorials database:

Tutorials_tbl(   tutorial_id INT not NULL auto_increment,   tutorial_title VARCHAR(100 ) not null, tutorial_author VARCHAR(+) not null, submission_date DATE,());               

Instance parsing:

    • If you do not want the fields to be null , you can set the field's property to not null, and you will get an error if the data entered in the field is null when you manipulate the database.
    • Auto_increment defines a property that is self-increasing, typically used for a primary key, and the value is automatically added to 1.
    • The PRIMARY key keyword is used to define the column as the primary key. You can use multiple columns to define a primary key, and the columns are separated by commas.

Delete table: Drop tables table name;

Insert statement

: INSERT into student values ("", "Wangjiao", now ());

INSERT into Tutorials_tbl(tutorial_title, tutorial_author, submission_date) - >VALUES ("JAVA Tutorial", "Sanjay", ' 2007-05-06 ');

MYSQL CREATE database table (delete, delete, insert)

Related Article

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.