免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
MySQL數(shù)據(jù)庫 SQL語句詳解
userphoto

2022.12.12 內(nèi)蒙古

關(guān)注

數(shù)據(jù)庫常用操作

操作語句
創(chuàng)建數(shù)據(jù)庫create database if not exists 數(shù)據(jù)庫名;
查看所有數(shù)據(jù)庫show databases;
切換數(shù)據(jù)庫use 數(shù)據(jù)庫名;
刪除數(shù)據(jù)庫drop database if exists 數(shù)據(jù)庫名;
修改數(shù)據(jù)庫編碼alter database 數(shù)據(jù)庫名 character set utf8;

表結(jié)構(gòu)常用操作

操作語句
創(chuàng)建表create table if not exists 表名(字段名 數(shù)據(jù)類型, 字段名 數(shù)據(jù)類型, ...);
查看當(dāng)前數(shù)據(jù)庫所有表show tables;
查看表結(jié)構(gòu)desc 表名;
查看指定表的創(chuàng)建語句show create table 表名;
刪除表drop table 表名;
添加列alter table 表名 add 列名 數(shù)據(jù)類型(長度);
修改列名和類型alter table 表名 change 舊列名 新列名數(shù)據(jù)類型(長度);
刪除列alter table 表名 drop 列名;
修改表名rename table 表名 to 新表名;

增刪改

操作語句
向表中插入列insert into 表名(列1, 列2, 列3) values(值1, 值1, 值1), (值2, 值2, 值2);
向表中所有列插入數(shù)據(jù)insert into 表名 values(值1, 值1, 值1);
數(shù)據(jù)修改update 表名 set 字段名=值, ... , 字段名=值 where 條件
刪除表中數(shù)據(jù)delete from 表名 where 條件
刪除表truncate 表名

MYSQL約束

操作語句
主鍵primary key
刪除主鍵約束alter table 表名 drop primary key;
自增長auto_increment
非空not null
創(chuàng)建表前指定create table 表名(id int not null, account varchar(20) not null);
創(chuàng)建表后指定alter table 表名 modify id int not null;
刪除非空約束alter table 表名 modify 字段 類型
唯一unique
刪除唯一約束alter table 表名 drop index 唯一約束名
默認(rèn)default
刪除默認(rèn)約束alter table 表名 modify 列名 類型 default null
零填充zerofill
刪除零填充約束alter table 表名 modify 字段 類型
外鍵foreign key

如果您覺得有幫助,請幫忙點(diǎn)一下公眾號文中和最底部的廣告,點(diǎn)一下就可以,謝謝~

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報(bào)
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
mysql常用操作指令——ALTER語句用法
mysql中SQL語句修改1
數(shù)據(jù)庫
非常有用的MySQL常用命令
MySQL_note
mysql 基礎(chǔ)操作
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服