DataBase -- Note I
- 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的更多相关文章
- 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 ...
- 【原】Configuring Oracle Data Guard In Physical Standby Database
作者:david_zhang@sh [转载时请以超链接形式标明文章] http://www.cnblogs.com/david-zhang-index/p/5042640.html参照文档:https ...
- P6 EPPM Manual Installation Guide (Oracle Database)
P6 EPPM Manual Installation Guide (Oracle Database) P6 EPPM Manual Installation Guide (Oracle Databa ...
- 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 ...
- 转载: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 ...
- [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 ...
- Log Sessions to Local Database
Add Rules to Fiddler to create a new menu item as follows: // Log the currently selected sessions in ...
- 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 ...
- 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 ...
随机推荐
- linux特殊权限位suid
特殊权限位基本说明(了解): linux系统基本权限位为9位权限,但还有额外3位权限位,共12位权限: suid s(x) S 4 用户对应的权限位(用户对应的3位 ...
- XStream 工具类 [ XmlUtil ]
pom.xml <dependency> <groupId>com.thoughtworks.xstream</groupId> <artifactId> ...
- 命名空间“Microsoft.Office”中不存在类型或命名空间名称“Interop”(是否缺少程序集引用?
在一个web项目中需要导出word打印,引用Microsoft.Office.Interop.Word后,在pages里使用正常,在app_code里新建类引用就报错. Report.cs里using ...
- 第一次认识lambda匿名函数
lambda 为了解决一些简单的需求而设计的"一句话"函数 语法 lambda 参数:返回值 1.可以多个参数,参数间用逗号隔开 2.匿名函数不管多复杂,只能写一行 3.返回值和正 ...
- Python全栈day 06
Python全栈day 06 一.数据类型补充完整 1. 列表(list) 反转reverse list1 = [1,2,3,4,5,6,7,8,9] list1.reverse() print(li ...
- dialog BLE SDK 学习(3)
dialog DA14580 SDK版本:5.0.4. 本文介绍了DA14580 SDK的学习感想和建议,分享给大家. 首先,Dialog官网上的资料挺全的,但是是英文的,如果英文不好,比如笔者,阅读 ...
- Immutable
Immutable 参考文章 https://zhuanlan.zhihu.com/p/20295971?columnSlug=purerender
- url_maneger.py
coding=UTF-8 # url管理器 class urlManeger: def __init__(self): self.new_urls = set() self.old_urls = se ...
- Eclipse+Tomcat7.0+MySQL 连接池设置
http://blog.sina.com.cn/s/blog_85d71fb70101ab99.html 工程名:JavaWeb 第一步:配置server.xml 在Tomcat的server.xml ...
- 3 破解密码,xshell连接
1.破解root密码 (1)启动电脑,按上下键进入启动菜单界面,选择第二个Red Hat Enterprise Linux Server, with Linux 0-rescue-* (2)按 'e' ...