Mysql 8.0 基本

create table[if not exists] table1(
col1 int,
col2 varchar(30),
col3 double(3,2)
);

show databases;

use table1;

show table from 数据库名称;

show columns from table1;

insert [into] table1 values(1,‘1’,0.0);

insert into table1(col1) values(1);

alter table table1 modify col1 int auto_increment primary key;

alter table table1 modify col2 varchar(30) unique key ;

alter table table1 modify col3 varchar(30) default ‘0’;

alter table table1 modify col1 int NULL;

create table tb1(
i int references table1(clo1) on cascade
);

cascade, set null ,restrict,no action

alter table table1add [column] col4 int ;

alter table table1 add column col5 varchar(30) after col3;

alter table table1 add column col6 varchar(30) first;

alter table table1 drop column col4;

alter table table1 drop primary key;

alter table table1 drop INDEX column_name;

insert table1 values(…),(…),(…);

insert table set col1=1,col2=‘1’;

update table1 set col1=col1+5;

updata table1 set col1=col1+1 where col1=1;;

delete from table1 where col1=1;

select col1,col2 from table1 having where count(col1)>0;

max,min,avg,sum;

select col1 as c1 from table1;

select col1,col2 from users group by col11 ;

select * from table1 order by col1 desc,col2 desc ;

select * from table1 limit 2;

select * from table limit 0,2;

insert table1(…)select col1from table2 where col1>0;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值