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

    例子:一个名为person的表,字段分别有name, age ,city,school,card,id

      注意:sql是对大小写不敏感

    1.select : select name from person 查询出person表的所有name字段

         select * from person 查询person表的所有数据

         select distinct name from person 查询person表的所有数据,但是和上麦年不一样的是查询出的name是不会重复的

         select * from person where name='lisi'查询名字是lisi的人。注意:条件查询的条件值要用单引号,但是如果是数值就不要使用引号

         select * from person where name="ll" and age=21

         select * fron person where ( name="dd" or age=34) and city='cn'

      order by 用于对制定的列对结果进行排序

         select name,age from person order by name desc;查询结果按逆排序 asc按顺排序

    2.insert :insert into person (name, age)values ("",20)

    3.update:update person set name="ws",age=10 where age=21;

    4.delete: delete from person where name=""

    5.like :select name from person where name like '%h' 查找以h结尾的名字 'g%'以g开头的名字 '%k%'包含k的名字

       

  • 相关阅读:
    poj 1182食物链
    几何原本查询程序1.0
    code forces 548C:Mike and frog
    CC2530串口通信
    CC2530定时器的应用
    CC2530应用——按键控制灯光状态变化
    步入LTE、多址技术
    定时器之基于模模式的间隔定时
    CC2530定时器
    配置路由器(1)
  • 原文地址:https://www.cnblogs.com/mylanlan-802888/p/4545785.html
Copyright © 2011-2022 走看看