Summary of mysqlsql statements (constantly updating .........)

Source: Internet
Author: User
Tags type null
Createdatabasemytestdefadefacharsetutf8 create database createtableusers create tables (tables, user_namevarchar (20) notnull, descriptionvarchar (200), primarykeyPK_userid (user_id); showcreatetableusers

Create database mytest default charset = utf8 // create table users // create a table (user_id int not null auto_increment, user_name varchar (20) not null, description varchar (200 ), primary key PK_userid (user_id); show create table users


Create database mytest default charset = utf8 // create a database

Create table users // create a table
(
User_id int not null auto_increment,
User_name varchar (20) not null,
Description varchar (200 ),
Primary key PK_userid (user_id)
);

Show create table users; // view the SQL statement of the created table

Desc users; // view the table structure

Alter table users add (user_age int not null); // add table Fields

Insert into users (user_name, description, user_age) values ('chen', 'this is good men. ', 28); // insert a data record

// Query the database

Select * from users limit 5; // query the first five

SELECT * FROM users LIMIT 6, 2; // query two items starting FROM 6th (inclusive)

// View the table data structure
Show columns from tablename;
The following fields are displayed:
Field type Null key default extra

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.