我的账户
猩码学苑

专注C++开发菁英教育

亲爱的游客,欢迎!

已有账号,请

如尚未注册?

李扬敏-20221205-mysql

[复制链接]
王源的李可爱 发表于 2022-12-5 23:44:53 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
一.今日学习内容
1.新建表格
类型
varchar----字符串
int---普通大小的整数
tinyint---很小的整数
smallint---小的整数
id
自动递增
主键:唯一表示
2.增删改查(crud)
增加
insert into  表名(字段1,字段2)  values (值1,值2);
insert into stu (name,age) values('add',12);
删除
delete from 表名 [where 条件];
中括号里的内容:在技术文档中代表可写可不写
不写:删除表中的所有的数据
delete from stu where name='add';
更新
update 表名 set key1=value1,key2=value2 [where 条件];
update stu set name='测试2' where id=15;
查询
select 字段列表或者*  from 表名 [where 条件];
select name,age,address from stu where id=1;
3.高级查询
=,>,<,>=,<=,<>不等于
字段 between a and b :在某个范围内
select * from stu where age between 18 and 25;
like ‘%内容%’:搜索某种模式,模糊查询
select * from stu where name like '%小%';
order by 字段 [desc] :排序
select * from stu order by age desc;
and 且
select * from stu where age>20 and name like '%小%';
limit m,n   跳过m条查询n条
select * from stu age limit 2,5;

回复

使用道具 举报

关注0

粉丝0

帖子58

发布主题
大家都在学
课堂讨论
一周热帖排行最近7x24小时热帖
关注我们
专注C++菁英教育

客服电话:18009298968

客服时间:9:00-21:00

猩码学苑 - 专注C++开发菁英教育!( 陕ICP备2025058934号-1 )

版权所有 © 陕西菁英数字科技有限公司 2023-2026