zoukankan      html  css  js  c++  java
  • 软件测试学习-数据库基础

    1. 查询语句

    select *(字段名) from 表名 

    2.删除语句

    delect from  表名

    3.更新语句

    update  表名 set 字段名=?  

    4.增加数据语句

    insert into 表名  values(),()....可以插入多个值

    insert into 表名(字段名)values(),()...可以插入多个值

    5.模糊查询(like)

    %(任意字符)   _(一个字符)

    例子: select * from  student  where  name like '冯%'  查询姓冯的所有人的信息

        select * from student where name like '冯_'  查询姓冯却只有一个字

    6.范围查询

    in  例子 :select  *  from  student  where hometown in('北京','广州','上海')  (查询家乡是北京或者是广州或者是上海的学生的信息)

                     select * from student where age between 18 and 20  (查询年龄18-20的学生的信息)

        select * from student where card is not null (查询card填写了的学生的信息)

        select *from student where card=''      (查询card没有填写的学生的信息)

    7.排序查询(默认升序asc)

    例子:select * from student order by age asc,student_NO desc(按照age的升序,student_NO 的降序查询学生的信息)

    8.聚合函数

    select max(age),min(age),sum(age), avg(age),count(age)(统计总数的功能) from student

    9.分组排序

    select sex count(*) from student group by sex having sex='男' (按照sex分组,having是筛选,筛选男的)

    10.分页查询

    select * from student limit 0,3 (从第零条开始,查询三天数据)

    distinct  过滤掉重复的数据

    primary key  主键  auto_increment  自增  unsigned (没有定义)理解为没有负数的定义 

    tinyint 一个字 节  int 四个字节  不用限制位数,因为已经有取值范围

    decimal (5,2)  五位数,有二位是小数

  • 相关阅读:
    算法和编程面试题
    递归,排序等算法编程题
    webservice部分和J2EE相关面试题
    有关线程的面试题
    JavaWeb部分面试题
    Html和JS的一些面试题
    pageContext,request,session,application四大作用域的区别
    企业架构研究总结(17)——联邦企业架构之我见
    企业架构研究总结(19)——TOGAF架构开发方法(ADM)之准备阶段
    企业架构研究总结(18)——TOGAF总论及架构开发方法(ADM)概述
  • 原文地址:https://www.cnblogs.com/1617-fung/p/11406443.html
Copyright © 2011-2022 走看看