sql azure 语法

介绍 (Introduction)

In the Azure Portal, you will find the option to install Azure SQL Cosmos DB. So, what is Cosmos DB, exactly?

在Azure门户中,您将找到安装Azure SQL Cosmos DB的选项。 那么,什么是Cosmos DB?

This article will clarify what Azure SQL Cosmos DB is, how much it costs, how to integrate it with SQL Server, how to scale the database and other related information.

本文将阐明什么是Azure SQL Cosmos DB,其成本,如何将其与SQL Server集成,如何扩展数据库以及其他相关信息。

什么是Azure SQL Cosmos DB? (What is Azure SQL Cosmos DB?)

It sounds like a Database to store documents, but it is a NoSQL Database used to store non-structured data in Azure. It was created by Microsoft as a high performance non-normalized database. It is flexible, with high availability and automatic scaling.

听起来像是一个用于存储文档的数据库,但是它是一个NoSQL数据库,用于在Azure中存储非结构化数据。 它是由Microsoft创建的高性能非标准化数据库。 它非常灵活,具有高可用性和自动缩放功能。

Cosmos DB, is not used to store documents like MS Words or PDF documents. It is used to store JSON documents.

Cosmos DB不用于存储MS Word或PDF文档之类的文档。 它用于存储JSON文档。

什么是JSON? (What is JSON?)

JSON (Java Script Object Notation) is a standard object notation used to transmit data objects. It is very popular in Web Services where it is replacing XML. It started on Java Script, but now it is a standard supported in several programming languages.

JSON(Java脚本对象表示法)是用于传输数据对象的标准对象表示法。 它在替换XML的Web服务中非常流行。 它始于Java Script,但现在已成为多种编程语言支持的标准。

学习JSON很难吗? (Is it hard to learn JSON?)

No, if you are a programmer, it will be a straightforward to learn JSON, because the object notation is very easy. If you are a DBA, it might be a little bit more difficult. In SQL Server 2016, JSON support is included, so, it looks like it is something that a DBA needs to eventually learn. In SQL Server if you are familiar with XML, using JSON will be very easy because the sentences are similar.

不,如果您是一名程序员,那么学习JSON将非常简单,因为对象表示法非常简单。 如果您是DBA,可能会有些困难。 在SQL Server 2016中,包括了JSON支持,因此,看起来DBA最终需要学习它。 在SQL Server中,如果您熟悉XML,则使用JSON将非常容易,因为句子很相似。

JSON语法示例 (JSON syntax example)

Here is an example for learning JSON:

这是学习JSON的示例:


{"customers":[
{"firstName":"John", "lastName":"Smith", "email":"jsmith@hotmail.com" },
{"firstName":"Peter", "lastName":"Jackson", "email":"pjackson@hotmail.com" },
{"firstName":"Maria", "lastName":"Simpson", "email":"msimpson@hotmail.com" }
]}

It is not hard.. The customer in the sample is the object and the firstName, lastName and email are the names with their values. The syntax is easy to read and very flexible. The data is separated by commas. Curly braces contain the objects and the square brackets contain arrays.

这并不难。样本中的客户是对象,而firstName,lastName和email是带有其值的名称。 语法易于阅读且非常灵活。 数据用逗号分隔。 花括号包含对象,方括号包含数组。

If you have worked with C# and Java, you know that it not so easy to parse elements from XML (at least not the first time). In JSON it is easier. That is why XML is dying and JSON is replacing it (however, in SQL Server using JSON is not easier than XML).

如果您使用过C#和Java,那么您就会知道,解析XML中的元素并不是那么容易(至少不是第一次)。 在JSON中更容易。 这就是XML快要枯竭而JSON取代它的原因(但是,在SQL Server中使用JSON并不比XML容易)。

JSON is very common also in Big Data (Azure HDInsight for example).

JSON在大数据中也很常见(例如,Azure HDInsight)。

Q: OK, everything is stored in JSON documents, but how can I query the Azure SQL Cosmos DB data?

问:好的,所有内容都存储在JSON文档中,但是如何查询Azure SQL Cosmos DB数据?

A: You can use traditional SQL. It may sound weird because Cosmos DB is for non-structured data, but Microsoft tried to make our life easier. That is why you can easily learn how to query Cosmos DB.

答:您可以使用传统SQL。 这听起来很奇怪,因为Cosmos DB用于非结构化数据,但是Microsoft试图使我们的生活更轻松。 这就是为什么您可以轻松学习如何查询Cosmos DB的原因。

Q: Cosmos DB is not related to Azure SQL Server. In which scenarios should I use Azure SQL Server and in which scenarios Cosmos DB?

问:Cosmos DB与Azure SQL Server不相关。 在哪些情况下应使用Azure SQL Server,在哪些情况下应使用Cosmos DB?

A: Cosmos DB is used specially in gaming, Social media and IoT (Internet Of Things) applications. If you have an application and it need to scale around the world and you have millions of users, Cosmos DB in Azure is a simple and inexpensive solution. Azure SQL for several millions of users is harder to scale. In general, a traditional Relational Database cannot scale as easy as simple JSON documents. The other problem is the data. Some applications require images and videos. It is really hard to store and handle these types of data in a relational database like Azure SQL.

答:Cosmos DB特别用于游戏,社交媒体和IoT(物联网)应用程序。 如果您拥有一个应用程序,并且需要在全球范围内扩展,并且您拥有数百万的用户,则Azure中的Cosmos DB是一种简单且廉价的解决方案。 数百万用户的Azure SQL很难扩展。 通常,传统的关系数据库无法像简单的JSON文档那样轻松地扩展。 另一个问题是数据。 某些应用程序需要图像和视频。 在像Azure SQL这样的关系数据库中存储和处理这些类型的数据确实非常困难。

A SQL Azure database is a great solution when you do not need to scale and deal with millions of users at the same time and the relational model is also a good idea.

当您不需要同时扩展和处理数百万个用户并且关系模型也是一个好主意时,SQL Azure数据库是一个很好的解决方案。

哪些客户正在使用Azure SQL Cosmos DB? (What customers are using Azure SQL Cosmos DB?)

One important customer is MSN.com, a web portal with half a billion monthly users and 20 TB of document storage.

一个重要的客户是MSN.com,这是一个拥有十亿月度用户和20 TB文档存储空间的门户网站。

Next games, a gaming company required a low latency solution to store for millions of users. They required to store millions of profiles from Facebook, Google, GameCenter and store the scores, chat messages, challenges, etc.

在接下来的游戏中 ,游戏公司需要一种低延迟解决方案来存储数百万用户。 他们需要存储来自Facebook,Google,GameCenter的数百万个个人资料,并存储分数,聊天消息,挑战等。

Halo 5, a popular XBOX game with more than 65 millions of users.

Halo 5,一款受欢迎的XBOX游戏,拥有超过6500万用户。

As you can see, usually we talk about several millions of users, low latency and a scalable solution.

如您所见,通常我们谈论的是数百万用户,低延迟和可扩展的解决方案。

听起来不错。 多少钱? (Sounds fine. What is the price?)

There are two ways:

有两种方法:

Pre-defined and User defined billing.

预定义和用户定义的帐单。

Pre-defined performance billing that depended on the data storage and the request units.

预定义的性能计费取决于数据存储和请求单位。

A S1 collection with 10 GB of storage and 250 request units per second costs $25 per month and a S3 with the same storage and 2500 request units per second costs $100 per month.

具有10 GB存储空间和每秒250个请求单位的S1集合每月费用为25美元,具有相同存储空间和每秒2500个请求单位的S3每月花费100美元。

The User-defined performance billing offers a storage of $0.25 per GB per month and each 100 request units reserved per $6 per month.

用户定义的性能计费提供每月每GB 0.25 USD的存储空间,以及每100 USD每月预留100个请求单位。

请求单位是什么? (What are the request units?)

A Request Unit is the throughput to get 1 KB document.

请求单位是获取1 KB文档的吞吐量。

什么是收藏集? (What is a collection?)

It is a container of JSON documents. You can have several collections in the same database. The size of a collection is unlimited because it can be compound of multiple disks from multiple servers.

它是JSON文档的容器。 您可以在同一数据库中有多个集合。 集合的大小不受限制,因为它可以由来自多个服务器的多个磁盘组成。

如何从SQL Server迁移到Azure SQL Cosmos DB? (How can I migrate from SQL Server to Azure SQL Cosmos DB?)

You can use the Cosmos DB Data Migration Tool. It is an open source to import data from SQL Server and other sources like CSV files, MongoDB, Azure Table Storage and other sources.

您可以使用Cosmos DB数据迁移工具。 它是从SQL Server和其他来源(例如CSV文件,MongoDB,Azure Table Storage和其他来源)导入数据的开源。

Cosmos DB如何扩展? (How does the Cosmos DB scale?)

The collections can be stored in multiple partitions. The information is stored in multiple solid state disks. If you need more disks, the database grows. The scaling is unlimited. For the partition it is used a partition key. The number specifies the partition used.

集合可以存储在多个分区中。 该信息存储在多个固态磁盘中。 如果需要更多磁盘,则数据库会增长。 缩放是无限的。 对于分区,使用分区键。 该数字指定使用的分区。

如何检索Azure SQL Cosmos数据库信息? (How can I retrieve the Azure SQL Cosmos DB information?)

Cosmos DB has a REST API that allows it to be called by any language capable of handling HTTP and HTTPS requests. There are libraries for Java, .NET, Python.

Cosmos DB具有REST API,可通过任何能够处理HTTP和HTTPS请求的语言进行调用。 有用于Java,.NET,Python的库。

结论 (Conclusion)

Azure SQL Cosmos DB is a new NoSQL database offered in Azure. It is a simple and inexpensive solution in the cloud used specially in Online Games, IoT applications and Social Media and other application with millions of users. It is possible to migrate data from SQL Server to Cosmos DB. The information is stored in JSON documents.

Azure SQL Cosmos DB是Azure中提供的新的NoSQL数据库。 它是一种简单,廉价的云解决方案,专门用于在线游戏,IoT应用程序和社交媒体以及数百万用户的其他应用程序。 可以将数据从SQL Server迁移到Cosmos DB。 该信息存储在JSON文档中。

The use of the NoSQL databases is growing because of the volume of data required to store them.

由于存储NoSQL数据库需要大量数据,因此NoSQL数据库的使用正在增长。

翻译自: https://www.sqlshack.com/what-is-azure-cosmos-db/

sql azure 语法

sql azure 语法_什么是Azure SQL Cosmos DB?相关推荐

  1. sql azure 语法_如何使用Azure门户,Cloud Shell和T-SQL复制Azure SQL数据库

    sql azure 语法 This article will provide an overview covering programmatically moving databases on the ...

  2. sql azure 语法_如何:Azure中SQL Server文件快照备份

    sql azure 语法 After receiving new additions to backup and restore capabilities of SQL Servers like fi ...

  3. sql azure 语法_如何将内部SQL Server数据库迁移到Azure

    sql azure 语法 Lately, database administrators often hear the question "have you tried Azure?&quo ...

  4. sql azure 语法_深入了解Azure Data Studio:扩展和Azure SQL DB开发

    sql azure 语法 In the previous articles listed below, we went through the Azure Data Studio tool, star ...

  5. sql azure 语法_Azure Data Studio中SQL Server架构比较扩展

    sql azure 语法 This article explores the SQL Server Schema Compare extension in the Azure Data Studio. ...

  6. sql azure 语法_将SQL工作负载迁移到Microsoft Azure:服务选择

    sql azure 语法 In the previous article, Migrating SQL workloads to Microsoft Azure: Planning the jump, ...

  7. sql azure 语法_在Azure中使用SQL Server 2016 CTP3

    sql azure 语法 As the time of the release of the next version of SQL Server is closing in, the cycle o ...

  8. sql azure 语法_如何将SQL数据迁移到Azure Cosmos DB

    sql azure 语法 In this article, I have explained the step by step process of migrating data from SQL S ...

  9. sql azure 语法_在Azure Data Studio中计划SQL笔记本

    sql azure 语法 SQL Notebooks are an interactive way of creating documents, executing T-SQL queries alo ...

最新文章

  1. java基础讲解05-----流程控制语句
  2. gridView里如何添加详情按钮,点击它可以转到另一页,以获取该行的详细信息。
  3. oracle dblink和dataguard,Oracle 建立 DBLINK
  4. java 字符串首字符大写_Java字符串为大写
  5. hibernate级联 cascade属性(转)
  6. Kubernetes(K8s) 1.14.3 单机版配置 node 节点 是 taint 时解决方法
  7. 线性规划问题及单纯形法-目标函数值极小大M法
  8. CVPR 2018 | Generative Image Inpainting with Contextual Attention 阅读笔记(翻译)
  9. 内存超频对游戏提升大吗 玩游戏有必要超频吗
  10. 易基因|植物育种:ChIP-seq(组蛋白)揭示H3K36me修饰影响温度诱导的植物可变剪接和开花
  11. FusionAccess桌面云模板制作
  12. 遗传算法python与matlab_遗传算法之Python实现代码
  13. Scikit-Learn入门教程
  14. 6-9.添加HLSL镜面高光
  15. pinia使用与如何安装详解详细教程
  16. Pdf.js 解决电子印章问题(最新)
  17. linux下apache 的安装,php安装过程
  18. 0基础跟班学习前端的第三天(因为上完一次课需要上一天自习啦~)内容整理归纳还有附带的小练习~希望大家多动手练习(二)
  19. Ubuntu 重命名文件
  20. 【香蕉oi】Tree(欧拉序、线段树)

热门文章

  1. css 根据不同屏幕设置间距_18-CSS问题-让多个div横排显示并设置间距解决方案
  2. 移动端安卓IOS系统判断,用js判断 iPhone6 iPhone6 plus iphonex?
  3. ios 横竖屏切换总结
  4. partial、struct、interface与C#和CLR的关系
  5. node.js服务端代码学习
  6. C#委托和事件(3)
  7. export ‘Switch‘ (imported as ‘Switch‘) was not found in ‘react-router-dom‘
  8. Shell编程之一:Shell基础编程
  9. (实用工具分享)网页元素截图工具
  10. 计算机网络学习笔记(7. 报文交换与分组交换①)