zoukankan      html  css  js  c++  java
  • SQL小结

    今天是番外篇,学习sql快两个星期了,一直没有小结过,乘着今天还有些印象(其实是今天那道多项式的题不会做),来总结一下.

    首先我理解的sql运行的基本模式为:admin->mysql->create database/select database->create table/select table->select column,other_column from table->operate;

    表现为:

    条件查询语法

    SELECT column, another_column, … FROM mytable

    WHERE condition

    AND/OR another_condition

    AND/OR …;

    值得注意的是,一套完整的询问会在最后才要以分号结尾,where 限定条件时以and/or并列其他要素与关键字,当用order限定时则用逗号区别,对于where来说,有以下操作:

     where意在限制条件,order则是在操作条件,一般配合limit使用截取操作区间,其基本操作为:

    order by column asc/desc(以asc升序或降序)

    limit num(int) offset num1(int)(从num开始向后截取num1个数据)

    还有一个distinct操作用于某一column存在于多组数据中随机返回该colum下的一组,感觉不怎么实用

    选取出唯一的结果的语法:

    SELECT DISTINCT column, another_column, … FROM mytable

    WHERE condition(s);

     

  • 相关阅读:
    make ubuntu desktop beautiful
    scratch 编程第二弹
    stratch pragramming
    emacs 安装与基本设置-1
    linux相关命令
    7-12
    python strip()
    python 正则表达式 re.sub & re.subn
    python 正则表达式 re.findall &re.finditer
    python 正则表达式 re.split
  • 原文地址:https://www.cnblogs.com/iloveysm/p/12405046.html
Copyright © 2011-2022 走看看