我的账户
猩码学苑

专注C++开发菁英教育

亲爱的游客,欢迎!

已有账号,请

如尚未注册?

康利-20221205-MySQL

[复制链接]
智商不在服务区 发表于 2022-12-7 12:02:50 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
一、学习内容:新建表格:
类型:
        1.varchar--字符型
        2.int--普通大小的整数
        3.tinyint---很小的整数
        4.smallint--小的整数

​        id:自增,自动递增
​        主键:唯一标识
​        增删改查(curd)
​      
        增加数据:
        语法:insert into 表名(字段1,字段2)values(值1,值2);
        insert into                 sutdent(name,age,sex,money,score)VALUES('王珊',12,'女',68,88);

        删除数据:
        语法:delete from 表明 [where条件];
        delete from sutdent where id="11";
        中括号:在技术文档中代表可写可不写
        不写:删除表中的所有的数据

        更新数据:
        语法:update 表名 set key1=value1,key2=value2 [where表名];
        update sutdent set age=45 where id=3;

        查询数据:
        语法:select 字段列表或者* from 表名 [where 条件];
        select name,age,sex from sutdent; //查询name,age,sex三个字段
        select *from sutdent; //查询所有字段
        select *from sutdent where age>15; //查询age字段大于15的所有数据

        高级查询
        = 等于
        <> 不等于
        > 大于
        < 小于
        >= 大于等于
        <= 小于等于

        between 在某个范围内
        like 搜索某种模式,模糊查询
        order by 字段 [desc] 排序
        and 且
        limit m,n 跳过m条查询n条
        select * from sutdent where name like "%小%";
        select * from teacher where age>40 and sex="男";
        select * from teacher order by age desc; //按照降序排列
        select * from teacher order by age asc; //按照升序排列
        select * from teacher order by age; //默认是按照升序排列
        select * from teacher limit 2,4;

回复

使用道具 举报

关注0

粉丝0

帖子68

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

客服电话:18009298968

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

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

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