Review simple MySQL statements

Source: Internet
Author: User
Tags null null

Show all databases: Show databases;

Create Database customer; customer is the database name;

Open Database: Use customer; open the database before you perform various operations;

Customer table ID number name gender age birth date salary phone number
Customer
ID name sex age birth salary phone

Create Table: Create Table customer (ID int (11) not null primary key auto_increment, name varchar (20), sex varchar (2), age int, birth date, salary double, phone varchar (11 ));


Display table structure: describe customer;

Delete table: Drop table customer;

Change the name length to 10.

Alter table: alter table customer modify name varchar (10) Not NULL;

Insert a data entry to the table: Zhang Weinan 20 null NULL;

Insert data: insert into customer values ("Zhang San", "male", 20, null );

Change the age of Michael Jacob to 18;

Modify data: Update customer set age = 19 Where name = "Zhang San ";

Delete Zhang San's data:

Delete data: delete from customer where name = "James ";


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.