含义和定义 (Meaning and definition)

SQL stands for Structured Query Language, a language for manipulating and talking about data in databases. It first came into use in 1970 and became a standard in 1986 by IBM in conjunction with several projects for the US government and for many years it remained a government-only project. It’s a programing language which is used to access data stored in a database.

SQL代表结构化查询语言,这是一种用于操作和讨论数据库中数据的语言。 它于1970年首次使用,并于1986年由IBM联合成为美国政府的多个项目的标准,多年来一直是仅政府项目。 这是一种编程语言,用于访问存储在数据库中的数据。

The word “SQL” is an acronym, which is associated, today, with “Structured Query Language”. It was originally called SEQUEL with a slightly different meaning. Some people still enunciate the acronym as SEQUEL and some people enunciate each individual letter, S-Q-L. They mean the same thing.

“ SQL”一词是首字母缩写词,今天与“结构化查询语言”相关联。 它最初被称为SEQUEL,含义略有不同。 有些人仍然将缩写词称为SEQUEL,有些人则将每个字母SQL都发了出来。 他们是同一回事。

SQL, as a data retrieval language, is an industry standard; All relational database products, SQL is the mechanism, language and syntax used to retrieve data from ar database.

SQL作为一种数据检索语言,是一种行业标准。 SQL是所有关系数据库产品,是用于从ar数据库检索数据的机制,语言和语法。

According to Wikipedia …

根据维基百科 …

  • “SQL is designed based on relational algebra and tuple relational calculus, SQL consists of many types of statements, which may be informally classed as sublanguages, commonly: a data query language (DQL),[a] a data definition language (DDL),[b] a data control language (DCL), and a data manipulation language (DML).The scope of SQL includes data query, data manipulation (insert, update and delete), data definition (schema creation and modification), and data access control. Although SQL is often described as, and to a great extent is, a declarative language (4GL), it also includes procedural elements.
  • “ SQL是根据关系代数和元组关系演算设计的,SQL由多种类型的语句组成,这些语句可以非正式地归类为子语言,通常是:数据查询语言(DQL),[a]数据定义语言(DDL), [b]数据控制语言(DCL)和数据操作语言(DML)。SQL的范围包括数据查询,数据操作(插入,更新和删除),数据定义(模式创建和修改)和数据访问控制。 尽管SQL通常被描述为声明性语言(4GL),并且在很大程度上被描述为声明性语言(4GL),但它也包含过程元素。
  • SQL was one of the first commercial languages for Edgar F. Codd’s relational model, as described in his influential 1970 paper, “A Relational Model of Data for Large Shared Data Banks”.[11] Despite not entirely adhering to the relational model as described by Codd, it became the most widely used database language “
  • SQL是Edgar F. Codd关系模型的最早的商业语言之一,正如他在1970年发表的颇有影响的论文“大型共享数据库的数据关系模型”中所述。[11] 尽管并未完全遵循Codd所描述的关系模型,但它已成为使用最广泛的数据库语言“

技术概述 (Technical overview)

SQL is a special-purpose programming language. That differentiates it from other languages like C, C++, JavaScript, or Java, which are all general-purpose programming languages. This means that SQL has a very particular purpose, which is to manipulate data sets. We manipulate the data sets using relational calculus.

SQL是一种专用的编程语言。 这使其与所有通用编程语言(如C,C ++,JavaScript或Java)区别开来。 这意味着SQL有一个非常特殊的目的,那就是操纵数据集。 我们使用关系演算来操纵数据集。

Typically, we can use SQL on any kind of databases or data sources and even if we can’t use SQL directly against some of the data sources, most query languages today have some relationship to SQL. In general, once you’ve learned SQL, it’s pretty easy to pick up other query languages.

通常,我们可以在任何类型的数据库或数据源上使用SQL,即使不能直接对某些数据源使用SQL,当今大多数查询语言也与SQL有一定关系。 通常,一旦您学习了SQL,就很容易选择其他查询语言。

SQL has a number of standards. It’s both ANSI and ISO standard compliant. These standards are vital because each relational database vendor has to implement the standard, at least as a lowest common denominator, so that you know that if you learn the SQL standard, you can apply that knowledge to other databases products.

SQL有许多标准。 它符合ANSI和ISO标准。 这些标准至关重要,因为每个关系数据库供应商都必须至少以最低公分母的形式实施该标准,以便您知道,如果您学习SQL标准,则可以将该知识应用于其他数据库产品。

Interesting facts:

有趣的事实:

  1. The first product available to the public that utilized the SQL language was in 1979 with Oracle, version 2, and Oracle remains one of the premier database systems today. 最早使用SQL语言的面向公众的产品是1979年发布的Oracle版本2,而Oracle仍然是当今主要的数据库系统之一。
  2. Most databases have some additional features that aren’t part of the standard. When you want to learn a particular database product, you’ll have to pick up on those. But the basic standards-based SQL will always be the same.
  3. 大多数数据库具有一些不属于标准的其他功能。 当您想学习特定的数据库产品时,您将不得不选择这些产品。 但是基于标准的基本SQL将始终相同。
  4. SQL is generally whitespace independent, meaning that if you want to add some space between clauses or expressions to make your statement easier to read, you can do soSQL通常是与空格无关的,这意味着如果您想在子句或表达式之间添加一些空间以使语句更易于阅读,则可以这样做
  5. The majority of SQL commands focused on four basic verbs i.e. SELECT INSERT, UPDATE and DELETE. 大多数SQL命令着重于四个基本动词,即SELECT INSERT,UPDATE和DELETE。

SQL is standardized in such a way by asking a specific questions of a database object, in the form of a structured query that a database knows how to respond to. SQL uses a command interpreter to parse the SQL. Because it’s such a powerful way of thinking about the data, SQL has been adopted into many database products. Some products support the SQL standard and add other features on top of it, and some support part, though not all, of the SQL standard.

通过以数据库知道如何响应的结构化查询的形式询问数据库对象的特定问题,以这种方式对SQL进行标准化。 SQL使用命令解释器来解析SQL。 因为它是一种考虑数据的强大方法,所以SQL已被许多数据库产品采用。 一些产品支持SQL标准并在其之上添加其他功能,而某些产品则支持SQL标准,尽管不是全部。

DML陈述式 (DML statements)

Before we start building SQL statements in SQL Server, we need to understand what the basic parts of a statement are. Overall, a “statement” is something you write in SQL to get an answer from a database or to make a change to it.

在开始在SQL Server中构建SQL语句之前,我们需要了解语句的基本部分。 总体而言,“语句”是您在SQL中编写的,用于从数据库中获取答案或对其进行更改。

DML stands for Data Manipulation Language statements. These are statements that read, add, edit or remove data

DML代表数据处理语言语句。 这些是读取,添加,编辑或删除数据的语句

  • An example statement would be:

    一个示例语句为:

    SELECT * FROM MyTable
    
  • A detailed explanation of SQL Update can be found here: Overview of the SQL update statement

    有关SQL更新的详细说明,请参见: SQL更新语句概述

  • A detailed explanation of SQL Insert can be found here: 有关SQL插入的详细说明,请参见: Overview of the SQL Insert statementSQL插入语句概述
  • A detailed explanation of SQL Delete can be found here: 有关SQL Delete的详细说明,请参见: Overview of the SQL Delete statementSQL Delete语句概述

DDL陈述式 (DDL statements)

DDL stands for Data Definition Language statements. These are statements that related to objects, such as tables, in SQL Server vs data. For example, to create a table, you would use a CREATE TABLE statement, specifying the name and other attributes of your table. Later you could use DML statements to add data to it, update or remove that data, and read the data

DDL代表数据定义语言语句。 这些是与SQL Server与数据中的对象(例如表)相关的语句。 例如,要创建表,可以使用CREATE TABLE语句,指定表的名称和其他属性。 以后,您可以使用DML语句向其中添加数据,更新或删除该数据以及读取数据

Note: A detailed explanation of SQL Create can be found here: Overview of the SQL create statement

注意:可在此处找到有关SQL Create的详细说明: SQL create语句概述

Create, Read (Select), Update (Update) and Delete (Delete) statements are referred to, collectively, by the acronym CRUD. A detailed explanation of SQL CRUD operations can be found here: Creating and using CRUD stored procedures

创建,读取(选择),更新(更新)和删除(删除)语句由首字母缩写CRUD共同引用。 有关SQL CRUD操作的详细说明,可以在这里找到: 创建和使用CRUD存储过程

条款 (Clauses)

Clauses are the basic components of SQL statements, the smaller building blocks that make up the whole. These clauses are constructed out of keywords, which tell the database to take a specific action. There are also field names, which tell the database where to look and what to look for. There are also predicates, which let us specify what information we’re working with. Predicates include a value or condition called an expression. A clause can be a statement if you’re writing a really basic one. There are also operators, as we’ll see later on, which let us compare equality or ranges of data or treat information in other ways.

子句是SQL语句的基本组件,是组成整体的较小的构建块。 这些子句由关键字构造而成,这些关键字告诉数据库采取特定操作。 也有字段名称,它们告诉数据库要在哪里寻找和寻找什么。 还有谓词,使我们可以指定正在使用的信息。 谓词包括一个称为表达式的值或条件。 如果要编写一个非常基本的子句,则子句可以是一条语句。 正如稍后将要看到的,还有一些运算符,它们使我们可以比较数据的相等性或范围,或以其他方式处理信息。

  • Note: Keywords and operators are customarily written as upper case, though usually, they don’t have to be. But, it helps to distinguish the SQL from your expressions and field names at a glance
  • 注意:关键字和运算符通常以大写形式编写,尽管通常不必如此。 但是,它有助于一眼将SQL与您的表达式和字段名称区分开

摘要 (Summary)

Using SQL you can choose to see some of the data; select data from specific tables only; add filtering to the data; manipulate the data. You can do all of that using the SQL language. So, think of SQL as the API, or Application Programming Interface, the primary language which you use to interact with your Database.

使用SQL,您可以选择查看一些数据。 仅从特定表中选择数据; 为数据添加过滤; 处理数据。 您可以使用SQL语言完成所有这些操作。 因此,可以将SQL视为API或应用程序编程接口,这是用于与数据库进行交互的主要语言。

Secondly, you can modify data; insert new data; update or delete existing data.

其次,您可以修改数据; 插入新数据; 更新或删除现有数据。

Third, the SQL language allows you to modify objects in the database. That is creating new tables. Or, modify the structure of existing tables, such as adding columns to tables or deleting columns from tables

第三,SQL语言允许您修改数据库中的对象。 那就是创建新表。 或者,修改现有表的结构,例如向表中添加列或从表中删除列

长处 (Strengths)

Some of the strengths of SQL include filtering particularly when running a SELECT statement. We have easy and powerful tools to filter the results that are returned to us. Sorting any results returned from a SQL query can easily is sorted ascending or descending on any column.

SQL的一些优势包括过滤,尤其是在运行SELECT语句时。 我们有简单而强大的工具来过滤返回给我们的结果。 可以很容易地对从SQL查询返回的所有结果进行排序,可以在任何列上进行升序或降序排序。

  1. A detailed explanation of the SQL Like operator can be found here: Overview of the SQL LIKE Operator
  2. 有关 SQL Like 运算符的 详细说明,请 参见此处: SQL LIKE运算符概述
  3. A detailed explanation of SQL Coalesce function a commonly used data manipulation function can be found here: Using the SQL Coalesce function in SQL Server
  4. 有关 SQL Coalesce 函数(一种常用的数据操作函数) 的详细说明, 可以在这里找到: 在SQL Server中使用SQL Coalesce函数
  5. A detailed explanation of the SQL Order by clause can be found here: Overview of the SQL Order by clause
  6. 有关 SQL Order by 子句的 详细说明,请 参见此处: SQL Order by子句概述

In SQL, the level of complexity of working with two or more tables is similar to the level of complexity of working with one table.

在SQL中,使用两个或多个表的复杂度类似于使用一个表的复杂度。

  1. A detailed explanation of SQL join can be found here: 有关SQL连接的详细说明,请参见: SQL Join overview and tutorialSQL连接概述和教程。

弱点 (Weaknesses)

The biggest drawback of SQL is the structured control flow. The basic SQL standard really doesn’t have any decision structures like IF-ELSE statements nor does it have much looping structures such as For, While, and Do-While, where we want to iterate over some condition clause to execute some SQL over and over.

SQL的最大缺点是结构化的控制流。 基本SQL标准实际上没有像IF-ELSE语句那样的任何决策结构,也没有像For,While和Do-While这样的循环结构,在这些结构中我们要迭代某些条件子句以在和之上执行某些SQL。过度。

Therefore, some vendors have come up with some specific solutions. These language-additions include all of the standard SQL commands to manipulate data. Microsoft implements T-SQL. The T stands for ”Transact”. Similarly, Oracle supports a programming extension, PLSQL aka Procedural Language SQL

因此,一些供应商提出了一些特定的解决方案。 这些语言添加包括所有用于处理数据的标准SQL命令。 Microsoft实现了T-SQL。 T代表“交易”。 同样,Oracle支持编程扩展,即PLSQL aka程序语言SQL

That’s all for now…

目前为止就这样了…

Hope you like this article. Feel free to comment below.

希望您喜欢这篇文章。 请在下面发表评论。

翻译自: https://www.sqlshack.com/what-is-sql-in-sql-server/

SQL Server中SQL是什么?相关推荐

  1. sql ddl中key_SQL DDL:SQL Server中SQL DDL命令入门

    sql ddl中key This article explains SQL DDL commands in Microsoft SQL Server using a few simple exampl ...

  2. SQL Server中SQL Union vs Union All

    This article explains to the SQL Union and vs Union All operators in SQL Server. We will also explor ...

  3. 整理:sql server 中sql语句执行顺序

    原文地址为: 整理:sql server 中sql语句执行顺序 SQL Server 查询处理中的各个阶段(SQL执行顺序) SQL 不同于与其他编程语言的最明显特征是处理代码的顺序.在大数编程语言中 ...

  4. SQL Server 中SQL语句执行顺序

    SQL Server 中SQL语句执行顺序 我们需要对SQL语句的执行顺序了若指掌,才能更好的理解SQL. SQL 不同于与其他编程语言的最明显特征是处理代码的顺序. 在大数编程语言中,代码按编码顺序 ...

  5. SQL server 中SQL语句实战操作

    学习网址链接: https://www.w3school.com.cn/sql/sql_top.asp 学习案例链接: https://wenku.baidu.com/view/720053b459f ...

  6. 如何解决SQL Server中SQL身份危机

    描述 (Description) SQL Identity columns provide a convenient way to auto-number an ID column within a ...

  7. SQL SERVER中SQL格式化插件——SQL Pretty Printer

    写SQL语句或者脚本时,看到凌乱的格式就头大了,于是决心找一款SQL语句格式化的工具. 功夫不负有心人还真的被我找到一款很好用,很方便的SQL Server插件:SQL Pretty Printer ...

  8. sql server datetime格式_为什么你SQL Server中SQL日期转换出错了呢?

    开发人员有时候使用类似下面SQL将字符串转换为日期时间类型,乍一看,这样的SQL的写法是没有什么问题的.但是这样的SQL其实有时候就是一个定时炸弹,随时可能出现问题(隐藏的炸弹而已,只是等触发条件而已 ...

  9. sql中的while循环_SQL While循环:了解SQL Server中的While循环

    sql中的while循环 The SQL While loop is used to repeatedly execute a certain piece of SQL script. SQL Whi ...

最新文章

  1. python识别验证码ocr_Python 验证码识别-- tesserocr
  2. 进程wait()与waitpid()
  3. springboot 历史版本文档_这个男人练了整整二年的SpringBoot看他如何教你学学学!...
  4. python函数模块关键代码_从零开始学Python(六):函数,模块和类的使用
  5. Nginx基本数据结构之ngx_hash_t
  6. es6 数组找最大值_JavaScript(es6)数组常用的方法
  7. python处理txt文件的一种情况
  8. 程序员编程艺术:第五章、寻找满足和为定值的两个或多个数
  9. FCKEditor报java.lang.NullPointerException
  10. CentOS 6.5 x64安装svn
  11. 系统名称:联想ThinkpadOEM Win7SP1简体中文旗舰版原版光盘镜像64位
  12. css 设置背景颜色渐变
  13. 微信支付 签名 java_Java后台微信支付签名算法(MD5)
  14. 【Haskell】函子 · 应用函子 · 单子
  15. mt950报文解析_MT报文有两种格式
  16. GWAS相关名词解释及基础知识储备[长期更新]
  17. Origin 三种方法在图片中添加水平辅助线
  18. js IP地址正则校验
  19. 2022年全球区块链审计公司排行榜
  20. 《机器学习实战》第二章 - k-近邻算法

热门文章

  1. APS计划排产软件实现新能源汽车企业人员结构优化
  2. 全向天线和定向天线的差异
  3. Python软件编程等级考试一级——20210905
  4. 蜂鸣器Speaker响8下、主板诊断卡D6除内存故障的另一角度
  5. ChatGPT写作:快速生成优质博客文章的神器
  6. pytorch加载预训练模型遇到的问题:KeyError: ‘bn1.num_batches_tracked‘
  7. MATLAB交流变频仿真,基于MATLABSimulink交流电机变频调速系统仿真(正文)
  8. Jupyter添加目录
  9. 智慧路灯杆网关厂家有哪些
  10. tftp + bras