数据库
首页 > 数据库> > MySQL深入学习

MySQL深入学习

作者:互联网

DML数据操纵语言

insert into

-- 插入
insert into biaoA(column_1,column_2) values('value1','value2')

update

-- 更新
update biaoA 
set column_1 = 'value1', column_2 = 'value2'
where condition
-- value可以是变量:时间

delete

-- 删除
delete from biaoA
where condition

truncate

-- 删除(自增会清零)
truncate biaoA

数据库重启:

InnoDB 自增列会从1开始(存在内存之中,断电即失)

MyISAM 继续从上一个自增量开始(存在于文件中,不会丢失)

DQL数据查询语言

select & 别名

-- 选中全部
select *
from biao_a ba 

-- 拼接
select concat('名称: ',column_1) 
from biao_a ba

distinct

-- 去重
select distinct column_1
from biao_a

-- 增加+1
select column_1 + 1
from biao_a

where

select column_1
from biao_a
where column_1 between 95 and 100
-- is not null
-- is null
-- like(_, __, %)
-- in(100,'value1','value2')

join

select ba.column_1, bb.column_2, bb.column_5
from biao_a ba
(inner) join biao_b
on ba.column_1 = bb.column_1	

标签:ba,column,biao,学习,深入,MySQL,where,select,biaoA
来源: https://www.cnblogs.com/WeirJin-cloud/p/13044631.html