MySQL basic syntax

Source: Internet
Author: User
Tags logical operators create database

MySQL basic syntax:

1. Create library: The name of the database;

Create a library with encoded format: Create database name character set encoding format;

Delete Library: drop database name;

2. CREATE TABLE: Name of Creation table table (field 1 type 1, field 2 Type 2, field 3 Type 3 ...) );

Delete table: drop database table name;

3, Increase (insert):

First format: INSERT into table name (Field 1, Field 2, Field 3, field 4) VALUES (value 1, value 2, value 3, value 4), (value 1, value 2, value 3, value 4), ...

Second format: INSERT into table name set field 1= value 1, field 2= value 2, field 3= value 3 ... ;

4. Delete (delete):

Delete from table name where condition

Such as:delete from table name where study number = 1;

5, change (update):

Update table name set field 1= value 1, field 2= value 2, field 3= value 3, ... Where condition

Such as:delete table name set Name= ' Zhang San ' where study number = ' 01 ';

6. Check (SELECT):

SELECT * from table name; Find all data in table

Select field 1, Field 2, ... from table name; Specify field value in lookup table

Select field 1 from table name where condition; find specified value for specified field in specified table

7. Logical operators common in MySQL: with (and), or (or), non (not)

8. Database query Language (DQL): Query statement for table, select

DB Definition Language (DDL): Create DATABASE, drop database, CREATE TABLE, drop table

Database manipulation Language (DML): UPDATE, INSERT, delete

MySQL basic syntax

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.