MYSQL Basic Operation Statement collation

Source: Internet
Author: User

Database: Create
Creatte {DATABASE | SCHEMA} [IF not EXISTS] db_name [DEFAULT] CHARACTER SET [=] charset_name.
Delete:
DROP {DATABASE | SCHEMA} [IF EXISTS] db_name;
Display:
show{databases| SCHEMAS} [like ' Pattern ' | WHERE expr];
Select:
Use database_name;


Data Tables Table: Create:
CREATE TABLE [IF not EXISTS] table_name (column_name data_type, ...)//() the name of each column within the library
Delete:
DROP TABLE [IF EXISTS] table_name;
Display:
SHOW TABLES [from db_name] [like ' Pattern ' | | Ehere expr];






Columns Column: Join:
ALTER TABLE tbl_name ADD [COLUMN] col_name column_definition [first| After Col_name]
First joins to the front end, after Col_name, followed by col_name, omitting the item, then adding it to the last face.
Delete:
ALTER TABLE tbl_name DROP [COLUMN] col_name;


record ROW: Join:
INSERT [Into]tbl_name [(Col_name,...)] VALUES (Val,..)
Delete:
DELETE from Tbl_name [WHERE where_condition]
Changes/updates:
Updata[low_priority][ignore] Table_reference SET col_name1={expr1| DEFAULT} [, col_name2={expr2| DEFAULT}] ...
[WHERE Where_condition]
Example: UPDATE users SET age=18 WHERE age=17;
Display:
SELECT expr, ... From Tal_name;
SELECT * from Tal_name; View All
Enquiry:
SELECT select_expr[, select_expr ...]
[
From Table_references
[WHERE Where_condition]
[GROUP by {col_name|position}[asc| DESC],...]
[Having where_condition]
[ORDER by {col_name|expr|position} [asc| DESC], ...]
[LIMIT {[Offset,]row_count|row_count offset}]
]
For example: SELECT name from users WHERE id=3;


Other:
constraint conditions:Not NULL; PRIMARY KEY; UNIQUE KEY; DEFAULT; FOREIGN KEY
other frequently used keyword: auto_increment



MYSQL Basic Operation Statement collation

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.