Mysql 基础使用文章目录
Mysql 基础使用前言一、Mysql是什么?二、使用步骤
1.创建一个新的表2.查询数据3.填写数据4.删除数据5.改写数据 总结
前言
Mysql增删改查是每名初学者都应该掌握的基础mysql语言,便于自己理解以及以后工作上的应用。
ps:本文为作者学习日常中笔记
提示:以下是本篇文章正文内容,下面案例可供参考
一、Mysql是什么? 二、使用步骤 1.创建一个新的表代码如下(示例):
-- 创建语句 -- 需求:创建表 create table goods( goods_name varchar(20), price decimal(4,2) ); -- 优化 drop table if exists goods; -- exists 指表如果存在,则删除 create table goods( goods_name varchar(20), price decimal(4,2) -- );2.查询数据
代码如下(示例):
select *from goods;
查询表内的某一列
select price from goods;
查询goods的表
3.填写数据-- 准备数据 drop table if EXISTS test01; create table test01( id int UNSIGNED PRIMARY key auto_increment, test01Name VARCHAR(20), price int, count int, company varchar(20), remark varchar(20) ); insert into test01 VALUES (0,'某想',36,100,'某东','电脑非常好'), (0,'某华',46,100,'某宝','专为青少年打造'), (0,'某碁',78,100,'某多','全场促销'), (0,'某星',26,100,'某购',null), (0,'某果',25,100,'某西','今日特价'); select * from test01;4.删除数据
delete from test01 where company = ’某东‘; --where 限制位置5.改写数据
update test01 set test01Name='某想',price=55,count=89,remark='今天全场甩卖' where id=3; select * from test01;总结
提示:这里对文章进行总结:
例如:以上就是今天要讲的内容,本文仅仅简单介绍了mysql的使用,而mysql提供了大量能使我们快速便捷地处理表内数据的查询以及整理。



