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

MySQL Learning Notes (2)-- A complete Collection of commands

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

Share

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

Command the semantic show databases; to view all the database show create database database names of the current database; view the current data creation method create database database name; use the system default character set to create the database create database database name character set character set; use the established character set to create the database drop database database name; delete the specified name database-this is the comment statement alter database database name character set character set Modify the character set use database name of the specified name database; use the database select database () of the specified name; view the database create table table name currently in use (column name data type,... Column name (the last one does not need a comma); create a table show tables; to view all table show create table table names in the current database; view the creation information of a table in the specified database desc table name View table information alter table table name add column name column data type constraint add column alter table table name modify column name modify content constraint modify column information alter table table name change column name modified name constraint modify column name alter table table name drop column name delete specified column rename table table name (before modification) to table name (after modification) modify table name alter table table name character set character set modify table character set Drop table table name delete the table with the specified name select * from table name view the data insert into user in the table (column 1 , column 5) values (value 1, value 5) All columns define insert into user (column 1, column 3, column 5) values (value 1, value 3, value 5); some columns select definition insert into user values (value 1, value 2, value 3, value 4, value 5); omit the column name, all values need to provide update table name set column name = value [where condition]; [] indicates optional modification of table record delete from table name [where condition] [] indicates optional deletion of data in the table, row by row deletion, inefficient truncate table table name to delete the entire table, and create a new table with the same name select column name, column name, … From table name look up the information of the specified column in the table select * from table name where conditional query >

< = = !=(不等于,不推荐使用,并不是sql语言)大于、小于、大于/小于等于、不等于between a and b在指定的a和b之间(包含a和b)_表示任意一个字符%表示任意零个多个字符is null、is not null是否为空,是否为非空and &&条件同时成立or ||条件任意成立一个即可not条件不成立select distinct 列名 from 表名过滤掉某列中的重复数据a as b别名order by asc / desc升序排列/降序排列 (默认升序)ifnull(列名, 默认值)如果表中某个数据为null,在计算的时候可以赋默认值avg()聚合函数,求平均值count()聚合函数,计数max()聚合函数,最大值min()聚合函数,最小值sum()聚合函数,求和group by 条件分组查询group by 条件 ,having 条件分组后实现过滤mysqldump -u 用户名 -p 数据库名 >

Disk SQL file path database backup mysql-u user name-p import library name < hard disk SQL file absolute path database recovery-recommended source hard disk SQL file absolute path database recovery

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