MySQL basic commands

Source: Internet
Author: User

SHOW DATABASES; Show all databases

SHOW TABLES; Show all tables under the current database

CREATE DATABASE dbname; New Database

CREATE TABLE tbname (id BIGINT UNSIGNED, PRIMARY KEY (id)); To create a new table, you must have at least one column when you create a new data table, a field to be defined when new, a three-part (name data type other optional attribute), a comma between each field, and a primary key after the group of the field definition list, in which MySQL uses the primary key to organize the contents of the table.

Use dbname; Using the dbname Database

DESCRIBE Tbname; Display the contents of the Tbname table

INSERT into Tbname (title, article) VALUES ("Hello", "hahahahaha"); Insert content in table, title, article field defined by new table

SELECT * FROM tbname WHERE id = 1; Select the contents of the id=1 in the Tbname table, * is a wildcard, denotes all fields, the position of * can also be changed to other fields, where is the filter condition

SELECT * from Tbname WHERE title like "%test%"; Select the row with the title "Tset" in the table, and% to indicate the string wildcard character

DELETE from tbname WHERE id = 1; Delete rows with ID 1 in the pages table

MySQL basic commands

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.