Home  >  Article  >  Database  >  Tutorials sharing common SQL syntax

Tutorials sharing common SQL syntax

零下一度
零下一度Original
2017-05-12 11:03:501237browse

Here are some common SQL syntax syntax, interested friends can take a look.

SQL_Basic

QueryCommand Template

选择[ALL | DISTINCT | DISTINCTROW | TOP] 
{* | talbe。* | [table。] field1 [AS alias1] [,[table。] field2 [AS alias2] [,...]]} 
FROM tableexpression [,...] [IN externaldatabase] 
[加入...]
[哪里...] [和/或] [喜欢]
[通过...分组…] 
[HAVING ...] 
[ORDER BY ...] [DESC]
[拥有自己的选择] 
联盟
...

Add

- 插
 - 选择列
 -  alter add(drop)增加,删除列
 - 创建数据库
 - 创建表
            CREATE TABLE表名称
            (
            列名称1数据类型,
            列名称2数据类型,
            列名称3数据类型,
            ....
            )
 - 列属性
    - 不空不为空属性
    - 唯一唯一属性,主·键具有独特属性
    - 首要的关键
    - 外键
    - 检查限定列为特定范围内的值
    - 默认设置列的默认项
    
  - 辅助手段  
    (指数)用于查询加速
     (AUTO_INCREMENT)自动增加序列
     查看结果集可视化的表
     数据类型
        -日期
         空值

Delete

 - 删除删除行
 - 删除
索引
,表,数据库
 -  alter add(drop)增加,删除列

Check

- 选择
 - 选择顶部
 -  seletc不同
 - 选择(in)(之间)和
 - 选择顺序
 - 类似于正则匹配的模式
 - 选择列改名
 -  
 - 加入(内联),左连接,右连接,完全连接
        SELECT Persons.LastName,Persons.FirstName,Orders.OrderNo
        从人
        
LEFT
 JOIN订单
        ON Persons.Id_P = Orders.Id_P
        ORDER BY Persons.LastName
        
- 辅助手段
    - 创建索引有助于快速查询
 -

Change

更新

calculate

平均数avg()
行计数()
访问第一个元素fisrt()
访问最后一个元素last()
最小数min()
最大数max()
求和()
分组+分组条件
字母大写ucase
字母小写lcase
提取字符
字符串
长度len
四舍五入轮
格式格式

【Related recommendations】

1. Free mysql online video tutorial

2. MySQL latest manual tutorial

3. Those things about database design

The above is the detailed content of Tutorials sharing common SQL syntax. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn