Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The basis of mysql (2) commonly used SQL statements

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

SQL statement type: DDL: database definition language create,drop,alter DML: data manipulation language insert,delete,update,select DCL: data control language grant Revoke commonly used SQL statements: CREATE DATABASE # create database CREATE TABLE # create table CREATE TABLE table_name (field name, field data type Constraints) # create table CREATE INDEX # create index data type: * × ×: int tinyint # 1byte smallint # 2byte mediumint # 3byte int # 4byte bigint # 8byte character type: char # fixed length character type (case insensitive) varchar # variable length character type (case insensitive) Binary # fixed length character type (case sensitive) varbinary # variable length character type (case sensitive) constraint: NOT NULL # does not allow empty DEFAULT # default Value PRIMARY KEY # primary key UNIQUE KEY # unique key unsigned # unsigned (for int type) auto_increment # self-increment Need to define in a key (applicable to int type) use example: show global variables # View the current session parameter show character set; of the global parameter show session variables; # mysql # View supported character sets show collation; # View supported collation show engines; # View supported storage engine show table status like 'user'\ G # View table status show global variables like'% server%'; # Database id show master logs; # View database binary log show master status; # View master server status show grants for 'dj'@'localhost'; # View dj user's authorization information show index from mysql.user # View index show databases; # View database show tables; # View database select field name from table name [where query condition] # View the contents of the table select * from user\ G # View the details of the user select databese (); # View the default database select * from test where id > 2 and id

< >

=

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report