1、SQL_Server简介外文翻译其他专业(完整版)(文档可以直接使用,也可根据实际需要修改使用,可编辑 欢迎下载)外文原文Introduction to SQL ServerBy SamuelRelational databases have been around for 30 years, but they were not the original kind ofdatabase, nor are they the newest kind of database. XML and object-oriented data structures haveevolved in recent
2、years. But relational databases are still by far the most popular kind of database available and will be for some time to come.SQL is the abbreviation of Structured Query Language and it is for relational databases, as the title indicates this is only for fresher who has just started the carrier or
3、who is waiting to open up the carrier in the application programming side. But that does not mean this article is a tutorial for a fresher who does not know anything about SQL.This article is meant for who already have a little knowledge in SQL and want toimprove it.What Does SQL Do?First, SQL is th
4、e premier tool for viewing information from a relational database. It doesnt just give you a data dump. SQL gives you sophisticated tools to summarize, consolidate, and calculate from the data. Using table relationships, data can be combined from multiple tables in a number of ways. With a properly
5、designed database, SQL can answer practically any question about the data.Second, SQL provides commands to manipulate the data in a relational database. Records can be updated and added to or deleted from a table. Here is SQL as a database language really shines. Procedural programming languages, su
6、ch as BASIC, might require several lines of code to update a record in a database table. In addition, procedural programming languages would have to use some sort of looping structure to repeat this process on every record. SQL operates on an entire set of records all at the same time. SQL is like h
7、aiku for programmers; often a dozen words or fewer can delete or change thousands of records.Finally, SQL is a complete data definition language (DDL). The database itself can be created along with all tables, fields, primary keys, and relationships. Add to that the record insert commands, and you c
8、an have a complete database and all its data expressed in programming code. This greatly enhances a database programmers ability to work remotely or to port data enhancements among various installations.The prerequisite for learning SQL is knowledge in Discrete Mathematics (Set Theory,Relations and
9、Functions). Although it is not necessary to learn all the theorems and proof for the theorems in the Discrete Mathematics, you should have learned the basic concepts of the Sets, Relations and Functions. This will help you to learn SQL queries and fundamentals easily. If you want to explore a RDBMS
10、more deeply you should learn Graph Theory too.Although I tried to avoid SQL Server specific topics in this article, I am sure that some topics are pure to SQL server such as SQL Enterprise manager.Data to DBMSData is something that should be stored for future manipulations (In terms of Database). Th
11、e system which provides such a facility is called Database Management System or DBMS.The simplest form to store a data for latter retrieval is using a text file. For example you may want to store your friends name and phone numbers to use it latter. (In this case you may use notepad or word to do so
12、.) This kind of storage is called flat file storage or unstructured storage. In this case the text editor uses the File and Directory services provided by the Operating System to accomplish the task of storing and retrieving data.But these unstructured flat files are not suitable to large data such
13、as storing stock details. Since the stock data is large in volume and added and updated frequently it is not scale up well if we use a simple flat file. To overcome this we need some system which should perform the storing, retrieving, manipulating and querying operations on the data and give output
14、 to us. This kind of system is called Database Management System. So a DBMS is a system which organizes and stores data in a structural way for fast retrieval. A DBMS uses one or more files to store the given data.Since the DBMS is meant mainly for developers every DBMS has it is own language to wri
15、te the commands. The languages are standardized under the name SQL(Structured Query Language). The following definition for SQL is from Books Online“A language used to insert, retrieve, modify, and delete data in a relational database.SQL also contains statements for defining and administering the o
16、bjects in a database. SQL is the language supported by most relational databases, and is the subject of standards published by the International Standards Organization (ISO)and the American National Standards Institute (ANSI). SQL Server 2000 uses a version of the SQL language called Transact-SQL.”R
17、epresentation of Data by DBMSDBMS should represent the data stored by them in some form and it is most common to represent them as Column, Row, Tables and Databases. As you know SQL you know what are columns, rows, tables and database.Primary KeyA column or set of columns used to uniquely identify t
18、he records in a table. Primary Keys dont allow NULL values. You can relate a table with other table if you have defined primary on it. (So defining UNIQUE and NOT NULL constraint is not equivalent to primary key). SQL server will create a Clustered index while you create a primary key.Primary keys s
19、hould be carefully defined since based on it other relations are defined. Poorly designed primary keys will affect insert, update and delete operations. Primary keys are different from which are used for paperwork.Foreign KeyThe primary key of one of the tables is almost always involved in the relat
20、ionship. The field in the other table on the other end of that relationship is called the foreign key. The termsimply refers to the fact that this field is key to relating to a foreign (or other) table. In the Lyric Music database there is a relationship between artists and titles. The ArtistID fiel
21、d is the primary key in the Artists table. Therefore, the ArtistID field in the Titles table is a foreign key. It relates the Titles table to the primary key in the Artists table.Most table relationships can be described as one-to-many. In a one-to-many relationship, a single record in the first tab
22、le can be related to many records in the second table. However, each record in the second table relates to only one record in the first table. In addition to one-to-many relationship, tables can have one-to-one relationships. But these are much less common.Server ClientIn Client Server technology, a
23、 server is a program which does all the jobs that is requested by the client and Client is a program which depends on the Server to accomplish its task. Client is mainly used to interact with Users and most Server software doesnt have direct interaction with Users.A DBMS should have the following fu
24、nctionality Interaction with users (developers),Managing Data. Since these two functionalities are entirely different modern DBMS is divided into two or more parts. Almost all current DBMS has the following module Server and one or more clients. A server module is program which manages the data and
25、handles requests from the client applications. It interprets the SQL queries and returns results back to the clients. A client program is a program which sends SQL commands to server and gets the result. Client program does not know the detailed underground structure of the server.SQL Server 2000 ru
26、ns as a service in NT based machines. You have to establish a connection to the server first if you want to do some SQL operation. SQL Server uses Local or Network IPC (Inter process communication) to communicate with the clients. See Books Online for more details.The most basic misunderstanding of
27、many junior developers is considering SQL Enterprise Manager as the SQL server. SQL Enterprise Manager is a tool used to access the SQL server. SQL Query analyzer is also similar tool used to access the SQL server. The difference between SQL query analyzer and Enterprise Manager is Query Analyzer is
28、 a light weight process and Enterprise manager is heavy weight processes due to its Graphical User Interface.Enterprise Manager is a handy tool in the initial stage of a project. It will save lot more time while designing the database. You can easily create Tables, Triggers, Relationships, Constrain
29、ts etc using Enterprise manger easily. I have seen many of developers dont have experience in using Enterprise Manager. Never become one of them, use Enterprise Manager whenever you start creating a database. Query Analyzer is a tool used to Create, Analyze, Modify and Delete T-SQL queries.You can a
30、lso access SQL server using osql.exe or isql.exe which is a very light weight command line utility. You can execute T-SQL commands in osql/isql. The difference between osql and isql is osql uses ODBC library whereas isql uses DB library to communicate with the SQL server. SQL Query analyzer is Windo
31、ws version of isql.exe.You can directly access SQL server by accessing the TCP Port/Named Pipes and issuing certain commands. However it is very tedious, so SQL Server has provided some library to access it easily. You can find the source code for these libraries in the installation directory of the
32、 SQL Server. For database communication standards SQL Server fully supports ODBC. Further it has own database driver for communication. SQL Server also offers SQL-DMO (SQL Distributed Management Objects) a COM component which offers easy programming interface. I have created one application called W
33、hiz using the SQL-DMO. You can download source code for that application in my projects page.Apart from these libraries many third party libraries are also available to access SQL Server. In .Net you can directly access SQL server using Data.SQLClient namespace.Now you have learned how SQL Server an
34、d SQL Client tools are exists in a network.It is time to learn some Client-Server technology rules1) There may be more than one connection to server at any time2) Client should request only what it wants3) Client requests should be shortThe first point is related to Server so leave it. The second po
35、int says that the client should retrieve only the data that it needs. This is because transferring data from Server to Client utilizes servers resource and also increases network traffic.DDL (Data Definition Language)What is data type? Classification of data into similar groups. Names, Money,Date, T
36、ime, etc are examples for data type.What is the use of classification or data type? It increases the performance, reduces the space needed to store the data.DML (Data Manipulation Language)Data Manipulation Languages contains command used to query, change, and add data from/to the database. This inc
37、ludes the following commands - SELECT, INSERT, DELETE. All these commands are deals with set of data. So I want to refresh the Set theory concepts before going further.TransactionsA transaction is a sequence of operations performed as a single logical unit of work. A logical unit of work must exhibi
38、t four properties, called the ACID (Atomicity, Consistency, Isolation, and Durability) properties, to qualify as a transaction.DTS (Data Transformation Services)Data Transformation Services are used to transfer and transform data from one datasource to another datasoure in the same server or another
39、 server.Some applications of DTS1) Copying data from one database to another database2) Copying data structure from one database to another database3) Migrating data from other datasources such as Flat File, Excel, Access, Oracle to SQL Server.4) Migrating data from SQL server to other datasources.S
40、ince the DTS topic is huge you cannot get to know what it is until you do actual task that is related to DTS. So try the following things and you will get to know something about DTS. Create an Excel file with the following columns EmployeeName, Address, DateOfJoin, PhoneNumber, MaritialStatus, and
41、Department. Fill this excel sheet with some meaningful information and then try to transfer the contents from Excel to SQL using DTS Import/Export Wizard.You can also create DTS packages which can be scheduled to run at future. DTS package programming allows mapping source fields to different destin
42、ation fields and also provides error control.SQL ProfilerSQL Profiler is a handy tool used to analyze what is happening inside and outside of a SQL Server. Simply it is a tool which extracts the log information from SQL server.These logs will help you debug applications, optimize queries, redesign d
43、atabase structure.Running SQL Profiler is very easy, Click SQL profiler from the SQL Server group menu. Then select New Trace from the file menu. It will open the connection dialog box. Type your server name, user name and password. Now you have to set options for your profile. The options include w
44、hat events you want to trace, what columns you want in the output, filters if any.DBCCDatabase Console Commands are referred as DBCC. DBCC contains some special commands through which you can accomplish certain DB operations which is not possible through normal SQL commands.外文翻译SQL server 简介塞缪尔著关系数据
45、库已经存在了30年,但他们不是原种的数据库,他们也不是最新的数据库。 XML和面向对象的数据结构在近几年已经发展。但是,关系数据库仍然是迄今为止最流行的数据库,并将于今后一段时间继续被人们所使用。SQL是结构化查询语言的缩写,并且用于关系数据库。如题目,这篇文章只是在应用程序编程方面刚开始开发或者准备开发项目的载体。但是,这并不意味着这篇文章能给初学者关于SQL的一个清楚的介绍。这篇文章是给那些关于SQL有一些了解,并且想提高水平的读者读的。SQL是干什么的?首先,SQL是用于查看关系数据库中的信息的首选工具。它不仅给你转储数据,而且是对数据总结、巩固和计算的先进工具。使用表关系,数据可以从来
46、自多个表中的许多方面被合并。SQL可以回答一个完善的数据库几乎所有有关数据的问题。其次,SQL提供了在关系数据库中数据的命令操纵功能,记录可以被更新并添加到一个表中或从一个表中删除,这是作为数据库语言SQL真正的闪光点。程序的编程语言,如BASIC,可能需要几行代码来更新数据库表的记录。此外,程序的编程语言就必须使用一些循环结构排序在每个记录中重复这一过程。SQL能在同一时间操作所有记录。 SQL对于程序员像是俳句,经常用很多语句或更少就可以删除或更改数千的记录。最后,SQL是一个完整的数据定义语言(DDL)。该数据库本身可以创建和所有表,字段,主键的关系。通过向该记录插入指令添加数据,你可以
47、有一个完整的数据库和所有编程代码表示的数据。这极大地增强了数据库编程的工作能力或者各端口远程数据的改进。学习SQL的先决条件是离散数学(集理论知识,关系和函数)。虽然没有必要学习所有的定理和离散数学定理证明,但是应该了解基本概念,关系和职能。这将帮助您学习SQL查询和基本内容。如果你想更深入探讨关系数据库管理系统,也应该学习图论。虽然我尽力在这篇文章中避免探讨SQL Server的特定主题,但是我确保这篇文章涉及到关于SQL Server,例如SQL企业管理器的内容。数据库管理系统的数据数据是在未来的操作中能存储的东西(在数据库方面)。该系统是能提供这样一种被称为数据库管理系统或DBMS的设施
48、。存储以备以后检索使用的数据的最简单的形式是使用文本文件。例如你为了以后使用想存储您朋友的名字和 号码(在这种情况下你可以使用记事本或Word来做)。这种存储形式被叫做平面文件存储或非结构化存储。在这种情况下,文本编辑器是使用以完成数据的存储和检索任务的操作系统提供的文件和目录服务来完成的。但是,这些非结构化的平面文件不适合存储大量数据,如股票的相关信息。由于股票的数据量较大并且添加和更新频繁,如果我们用一个简单的平面文件不能很好的扩展。为了克服这一点,我们需要一些对数据执行存储,检索,操作和查询操作并将结果输出给我们的系统,这种系统被称为数据库管理系统。因此,一个数据库管理系统是一个在一结构
49、方式快速检索、组织和存储数据的系统。一个数据库管理系统对给定数据使用一个或多个文件存储。由于开发的数据库管理系统都会用自己的语言去写命令,这个标准化的语言的名称是SQL(结构化查询语言)。以下是网上丛书对SQL的定义 “在关系数据库中用来插入,检索,修改数据的一种语言,还包含在数据库中定义和管理对象。 SQL是大多数关系数据库支持的语言,并且是由国际标准化组织(ISO公布的标准)和美国国家标准学会(ANSI)确定的主题。SQL Server 2000使用一种被称为Transact - SQL的SQL语言的版本” 。通过数据库管理系统表示数据数据库管理系统应该代表他们在某种形式下存储的数据,最常见的代表是列,行,表格和数据库。如你所知SQL让您知道什么是列,行,表和数据库。主键主