• SQL对大小写不敏感!
  • SQL DML和DDL:可以把SQL分为两个部分:数据操作语言(DML)和数据定义语言(DDL)
  • SQL(结构化查询语言)是用于执行查询的语法。但是SQL语言也包含用于更新、插入和删除记录的语法。
  • 查询和更新指令构成了SQL的DML部分:
    • select,update,delete,insert into等
  • SQL的数据定义语言(DDL)部分使我们有能力创建或删除表格。也可以定义索引键,规定表之间的链接,以及施加表之间的约束。
    • create database - 创建新的数据库
    • alert database - 修改数据库
    • create table - 创建新表
    • alert table - 变更数据库表
    • drop table - 删除表
    • create index - 创建索引表
    • drop index - 删除索引
  •  

使用样例:

  • Distinct关键词:在数据库表中可能含有重复值,不过有时你并不像看这些重复值有几个,可以使用该关键词。语法为:
  • select distinct 列名称 from 表名称 
    SQL 的Date函数:当我们处理日期时,要确保插入的日期格式与数据库中的格式是匹配的。
    MySQL Date函数:
函数 描述
NOW()         返回当前的日期和时间
CURDATE()  返回当前的日期
CURTIME() 返回当前的时间
DATE() 提取日期或日期/时间表达式的日期部分
EXTRACT() 返回日期/时间按……的单独部分                       
DATE_ADD() 给日期添加指定的时间间隔
DATE_SUB() 从日期减去指定的时间间隔
DATEDIFF() 返回两个日期之间的天数
DATE_FROMAT()        用不同的格式显示日期/时间

  • SQL Server Date函数:
函数       描述        
GETDATE()  返回当前日期和时间     
DATEPERT()  返回日期/时间的单独部分
DATEADD()  在日期中添加或减去指定的时间间隔    
DATEDIFF() 返回两个日期之间的时间
CONVERT() 用不同的格式显示日期/时间

DataBase -- Note I的更多相关文章

  1. How to Use Lucene.NET with Windows Azure SQL Database

    http://social.technet.microsoft.com/wiki/contents/articles/2367.how-to-use-lucene-net-with-windows-a ...

  2. 【原】Configuring Oracle Data Guard In Physical Standby Database

    作者:david_zhang@sh [转载时请以超链接形式标明文章] http://www.cnblogs.com/david-zhang-index/p/5042640.html参照文档:https ...

  3. P6 EPPM Manual Installation Guide (Oracle Database)

    P6 EPPM Manual Installation Guide (Oracle Database) P6 EPPM Manual Installation Guide (Oracle Databa ...

  4. P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1

    P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1       May ...

  5. 转载:Character data is represented incorrectly when the code page of the client computer differs from the code page of the database in SQL Server 2005

    https://support.microsoft.com/en-us/kb/904803 Character data is represented incorrectly when the cod ...

  6. [Windows Azure] Managing SQL Database using SQL Server Management Studio

    Managing Windows Azure SQL Database using SQL Server Management Studio You can use Windows Azure SQL ...

  7. Log Sessions to Local Database

    Add Rules to Fiddler to create a new menu item as follows: // Log the currently selected sessions in ...

  8. How to Baskup and Restore a MySQL database

    If you're storing anything in MySQL databases that you do not want to lose, it is very important to ...

  9. Steps to Resolve the Database JAVAVM Component if it Becomes INVALID After Applying an OJVM Patch

    11.2.0.2升级到11.2.0.4 memory_target 设置过小,只有800M. 导致jserver jave virtual machine 组件无法安装, 建议升级之前至少memory ...

随机推荐

  1. 51nod 1298 圆与三角形——计算几何

    题目链接:http://www.51nod.com/Challenge/Problem.html#!#problemId=1298 转化成判断三条线段和圆是否

  2. lintcode 110最小路径和

    最小路径和   描述 笔记 数据 评测 给定一个只含非负整数的m*n网格,找到一条从左上角到右下角的可以使数字和最小的路径. 注意事项 你在同一时间只能向下或者向右移动一步 您在真实的面试中是否遇到过 ...

  3. phpmailer类的再封装

    email <?php use PHPMailer\PHPMailer\PHPMailer; class Email { const SMTPDebug = 2; const HOST = 's ...

  4. pc和移动端页面字体设置

    移动端项目:font-family:Tahoma,Arial,Roboto,”Droid Sans”,”Helvetica Neue”,”Droid Sans Fallback”,”Heiti SC” ...

  5. 图解HTTP总结(4)——返回结果的HTTP状态码

    HTTP状态码负责表示客户端HTTP请求的返回结果.标记服务器端的处理是否正常.通知出现的错误等工作. 状态码的类别 2XX 成功 200 OK 表示从客户端发来的请求在服务器端被正常处理了. 在响应 ...

  6. strak组件(8):基本增删改查实现及应用和排序

    效果图: 新增函数: def reverse_common_url(self, name, *args, **kwargs) 反向生成url,需要传增删改的url作为参数,携带原参数 def reve ...

  7. source tree 使用心得

    SourceTree 是 Windows 和Mac OS X 下免费的 Git 和 Hg 客户端管理工具,同时也是Mercurial和Subversion版本控制系统工具.支持创建.克隆.提交.pus ...

  8. Bootstrap3适配IE8浏览器的方法

    <!--[if lte IE 8]> <script src="js/respond.min.js"></script> <script ...

  9. mysql学习第三天练习(日期和时间函数)

    -- 日期和时间函数 -- 获取当前日期 select curdate(),current_date() from dual -- 返回服务器当前的日期和时间 select NOW(),SYSDATE ...

  10. python基础之正则表达式爬虫应用,configparser模块和subprocess模块

    正则表达式爬虫应用(校花网) 1 import requests 2 import re 3 import json 4 #定义函数返回网页的字符串信息 5 def getPage_str(url): ...