zoukankan      html  css  js  c++  java
  • 数据库的增删改查

    primary key 维一键 不为空       autoinc 自动增长 在前面数自动加一

    不加*搜什么就是什么 加*是所有信息
     
    order by stuname asc  按名字升序排列   desc 降序
     
    创建数据表
    create table class
    (
       cid  integer  primary key  autoincrement    ,
       cname varchar(20)
    )
    查询语句
    select * from class
    增加语句
    insert into class (cname) values('IOS实训班')
    修改语句
    update class set cname='物联网'  where cid=2
    删除语句
    delete from class where cid=2
    查询表中的记录数
    select count(*) from class
    select count(*) from class where cname='数据库'
    select * from class where cname='数据库'
    select cid from class where cname='数据库'
    select cid,cname from class where cname='数据库'
    select cid,cname from class where cid>=5 and cid<=9
    select cid,cname from class where cid   between 5 and 9
    select cid,cname from class where cid   in(5,6,7,8,9)
    降序排列
    select * from class  order by cid  desc
    升序排列
    select * from class  order by cid   asc
    select * from class  where cname='数据库'  order by cid  desc
    select * from class  where cname like  '%库'  order by cid  desc
    select * from class  where cname like  '数_库'  order by cid  desc
    分组
    select count(*) from class group by cname
    select count(*)   count  from class group by cname  order by count desc
  • 相关阅读:
    浅谈js 构造函数 以及 new 运算符
    zabbix学习(一)——LNMP环境搭建及zabbix安装
    K8s部署使用CFSSL创建证书
    kubernetes环境搭建 -k8s笔记(一)
    windows下python3和python2虚拟环境配置
    QEMU/KVM网络模式(二)——NAT
    KVM安装
    QEMU网络模式(一)——bridge
    百度地图、腾讯地图、高德地图经纬度转换
    DOS入门(2)
  • 原文地址:https://www.cnblogs.com/wujie123/p/5308982.html
Copyright © 2011-2022 走看看