zoukankan      html  css  js  c++  java
  • SQL 基础

    1.Select 语句:从表中选取数据

    语法:

    SELECT 列名称,列名称 FROM  表名称

    SELECT * FROM 表名称

    注意:SQL对大小写不敏感

    2.SELECT DISTINCT 列名称 FROM 表名称(DISTINCT关键字   用于返回唯一不同的值)

    3.SELECT 列名称 FROM  表名称 WHERE  列  运算符 值

    运算符:{ =  <> > < >= <=  BETWEEN LIKE}

    例如:select *from enterprise where city = '哈尔滨'     //注意:SQL使用单引号来围绕 文本值  如果是数值,不用任何符号。

    4.AND 和 OR  AND和OR 运算符 可以把WHERE 子语句中的两个或者多个条件结合起来。

    AND 如果都成立,则返回数据

    OR 只要其中一条成立,则返回数据

    例如:select *from enterprise where city = '哈尔滨' or city = '南京'  

       select *from enterprise where city = '哈尔滨' and area = '软件'

    limit语句

    select *from enterprise limit 10  //(选择前10行)

    select  * from enterprise limit 0,5 //(选择从第0行到第5行的数据)

    like操作符

    select * from enterprise where city like'%滨'

    提示:“%”  可用于定义通配符  如果:   ‘%N’  就是表示以N结尾的    ‘A%’ 表示以A开头的      ‘%K%’  就表示保函K的

  • 相关阅读:
    Spring Boot 之Profile
    Spring Security初识
    Github使用进阶
    数据库JDBC
    Java内存模型(JMM)的可见性
    Spring Boot 整合Spring Data JPA
    Git版本控制工具初识
    Linux美化——终端提示符
    Python's Exception 层级结构
    试写Python内建函数range()
  • 原文地址:https://www.cnblogs.com/darwen/p/7908101.html
Copyright © 2011-2022 走看看