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 ...
随机推荐
- DateTools,可能是最好用的iOS日期工具库
项目简介 DateTools 用于提高Objective-C中日期和时间相关操作的效率.灵感来源于 DateTime和Time Period Library. 项目主页: DateTools 最新示例 ...
- vue 用户输入搜索 与无限下拉
vue项目中,用户输入关键字搜索,并且手机端做无限下拉 watch: { 'getListForm.searchKey'(val) { this.radioChange(); // 还有其他逻辑,内部 ...
- ubuntu修改IP地址和网关的方法
一.使用命令设置Ubuntu IP地址 1.修改配置文件blacklist.conf禁用IPV6 sudo vi /etc/modprobe.d/blacklist.conf 表示用vi编辑器(也可以 ...
- 使用JDBC操作数据库
准备工作 1.创建一个java项目导入mysql驱动包 2.在src目录中创建一个新的Java类 JDBC查询: package com.ATedu.test; import java.sql.Con ...
- POJ:3262-Protecting the Flowers
Protecting the Flowers Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8606 Accepted: 347 ...
- html_parser.py
coding=UTF-8 # HTML解释器 import re from bs4 import BeautifulSoup class htmlParser(): def parse(self, u ...
- LoadRunner使用代理远程执行提示找不到“pre_cci.c”文件
好久没有使用LoadRunner了,工作需要使用一下,执行总是提示找不到“pre_cci.c”文件,找问题花了很长时间终于找到问题了.万事还是需要找到原因: cci 会将 pre_cci.c 文件作为 ...
- 6 Django的视图层
视图函数 一个视图函数,简称视图,是一个简单的Python 函数,它接受Web请求并且返回Web响应.响应可以是一张网页的HTML内容,一个重定向,一个404错误,一个XML文档,或者一张图片. . ...
- laravel5.5探究容器的秘密
目录 1. 定义一个契约(接口) 2. 一个实现这个接口的类 3. 创建服务提供者 4. 注册服务提供者 5. 创建facades 6. 再然后需要到配置文件config/app.php中注册门面类别 ...
- Server Message Block
Question: Server Message Block文件共享存储虚拟机的优势是什么? Answer:微软在Windows Server 2012和Hyper-V 3.0中引进了SMB文件共享存 ...