mysql資料庫表操作常用命令以及注意事項

2021-09-23 08:02:09 字數 660 閱讀 2130

delete from 表名 where 1=1 order by 列名 limit 10;
delete from 表名 where 1=1 order by -列名 limit 10;
truncate table 表名;
select concat( 'drop table if exists ', table_name, ';' ) 

from information_schema.tables

where information_schema.tables.table_name like 'epc_%';

# 該語句會生成刪除 以epc_開頭的表的sql語句,複製到workbench中執行即可

insert into 表名(列1, 列2 , 列3, 列4 )values

('列1值1','列2值1' , '列3值1' , '列4值1'),

('列1值2','列2值2' , '列3值2' , '列4值2'),

('列1值3','列2值3' , '列3值3' , '列4值3');

charset="utf8"不是真正的utf-8,而"utf8mb4"才是真正的utf-8

MySQL資料庫常用命令操作

登入 mysql uroot p123456 建立資料庫 create database 資料庫名 切換資料庫 use 資料庫名 查詢資料庫中所有的資料表 show tables 建立新的資料表 create table 資料表名 欄位名 資料型別,欄位名 資料型別,非空約束 not null 建表...

mysql資料庫的常用操作 常用命令

恢復內容開始 mysql常用命令 mysql建立資料表 語法 create table table name column name column type 建立乙個 student 表 1 create table student 2 stu id int notnull auto increme...

終端資料庫操作mysql常用命令

mysql常用命令 命令說明 mysql uroot p 登入資料庫。u後邊是使用者名稱 p後面是密碼 show now 顯示時間 quit 或 exit 或ctrl d 退出資料庫 資料庫登陸後的操作語句 命令說明 show databases 檢視所有資料庫 create database資料庫...