SQL数据库外文翻译--数据库的工作

合集下载

外文翻译---数据库管理

外文翻译---数据库管理

英文资料翻译资料出处:From /china/ database英文原文:Database ManagementDatabase (sometimes spelled database) is also called an electronic database, referring to any collections of data, or information, that is specially organized for rapid search and retrieval by a computer. Databases are structured to facilitate the storage, retrieval modification and deletion of data in conjunction with various data-processing operations. Database can be stored on magnetic disk or tape, optical disk, or some other secondary storage device.A database consists of a file or a set of files. The information in the these files may be broken down into records, each of which consists of one or more fields are the basic units of data storage, and each field typically contains information pertaining to one aspect or attribute of the entity described by the database. Using keywords and various sorting commands, users can rapidly search, rearrange, group, and select the fields in many records to retrieve or create reports on particular aggregates of data.Database records and files must be organized to allow retrieval of the information. Early system were arranged sequentially (i.e., alphabetically, numerically, or chronologically); the development of direct-access storage devices made possible random access to data via indexes. Queries are the main way users retrieve database information. Typically the user provides a string of characters, and the computer searches the database for a corresponding sequence and provides the source materials in which those characters appear. A user can request, for example, all records in which the content of the field for a person’s last name is the word Smith.The many users of a large database must be able to manipulate the information within it quickly at any given time. Moreover, large business and other organizations tend to build up many independent files containing related and even overlapping data, and their data, processing activities often require the linking of data from several files.Several different types of database management systems have been developed to support these requirements: flat, hierarchical, network, relational, and object-oriented.In flat databases, records are organized according to a simple list of entities; many simple databases for personal computers are flat in structure. The records in hierarchical databases are organized in a treelike structure, with each level of records branching off into a set of smaller categories. Unlike hierarchical databases, which provide single links between sets of records at different levels, network databases create multiple linkages between sets by placing links, or pointers, to one set of records in another; the speed and versatility of network databases have led to their wide use in business. Relational databases are used where associations among files or records cannot be expressed by links; a simple flat list becomes one table, or “relation”, and multiple relations can be mathematically associated to yield desired information. Object-oriented databases store and manipulate more complex data structures, called “objects”, which are organized into hierarchical classes that may inherit properties from classes higher in the chain; this database structure is the most flexible and adaptable.The information in many databases consists of natural-language texts of documents; number-oriented database primarily contain information such as statistics, tables, financial data, and raw scientific and technical data. Small databases can be maintained on personal-computer systems and may be used by individuals at home. These and larger databases have become increasingly important in business life. Typical commercial applications include airline reservations, production management, medical records in hospitals, and legal records of insurance companies. The largest databases are usually maintained by governmental agencies, business organizations, and universities. These databases may contain texts of such materials as catalogs of various kinds. Reference databases contain bibliographies or indexes that serve as guides to the location of information in books, periodicals, and other published literature. Thousands of these publicly accessible databases now exist, covering topics ranging from law, medicine, and engineering to news and current events, games, classified advertisements, and instructional courses. Professionals such as scientists,doctors, lawyers, financial analysts, stockbrokers, and researchers of all types increasingly rely on these databases for quick, selective access to large volumes of information.一、DBMS Structuring TechniquesSequential, direct, and other file processing approaches are used to organize and structure data in single files. But a DBMS is able to integrate data elements from several files to answer specific user inquiries for information. That is, the DBMS is able to structure and tie together the logically related data from several large files.Logical Structures. Identifying these logical relationships is a job of the data administrator. A data definition language is used for this purpose. The DBMS may then employ one of the following logical structuring techniques during storage access, and retrieval operations.List structures. In this logical approach, records are linked together by the use of pointers. A pointer is a data item in one record that identifies the storage location of another logically related record. Records in a customer master file, for example, will contain the name and address of each customer, and each record in this file is identified by an account number. During an accounting period, a customer may buy a number of items on different days. Thus, the company may maintain an invoice file to reflect these transactions. A list structure could be used in this situation to show the unpaid invoices at any given time. Each record in the customer in the invoice file. This invoice record, in turn, would be linked to later invoices for the customer. The last invoice in the chain would be identified by the use of a special character as a pointer.Hierarchical (tree) structures. In this logical approach, data units are structured in multiple levels that graphically resemble an “upside down”tree with the root at the top and the branches formed below. There’s a superior-subordinate relationship in a hierarchical (tree) structure. Below the single-root data component are subordinate elements or nodes, each of which, in turn, “own”one or more other elements (or none). Each element or branch in this structure below the root has only a single owner. Thus, a customer owns an invoice, and the invoice has subordinate items. Thebranches in a tree structure are not connected.Network Structures. Unlike the tree approach, which does not permit the connection of branches, the network structure permits the connection of the nodes in a multidirectional manner. Thus, each node may have several owners and may, in turn, own any number of other data units. Data management software permits the extraction of the needed information from such a structure by beginning with any record in a file.Relational structures. A relational structure is made up of many tables. The data are stored in the form of “relations”in these tables. For example, relation tables could be established to link a college course with the instructor of the course, and with the location of the class.To find the name of the instructor and the location of the English class, the course/instructor relation is searched to get the name (“Fitt”), and the course/locati on relation is a relatively new database structuring approach that’s expected to be widely implemented in the future.Physical Structures. People visualize or structure data in logical ways for their own purposes. Thus, records R1 and R2 may always be logically linked and processed in sequence in one particular application. However, in a computer system it’s quite possible that these records that are logically contiguous in one application are not physically stored together. Rather, the physical structure of the records in media and hardware may depend not only on the I/O and storage devices and techniques used, but also on the different logical relationships that users may assign to the data found in R1and R2. For example, R1 and R2 may be records of credit customers who have shipments send to the same block in the same city every 2 weeks. From the shipping department manager’s perspective, then, R1 and R2 are sequential entries on a geographically organized shipping report. But in the A/R application, the customers represented by R1 and R2 may be identified, and their accounts may be processed, according to their account numbers which are widely separated. In short, then, the physical location of the stored records in many computer-based information systems is invisible to users.二、Database Management Features of OracleOracle includes many features that make the database easier to manage. We’ve divided the discussion in this section into three categories: Oracle Enterprise Manager, add-on packs, backup and recovery.1.Oracle Enterprise ManagerAs part of every Database Server, Oracle provides the Oracle Enterprise Manager (EM), a database management tool framework with a graphical interface used to manage database users, instances, and features (such as replication) that can provide additional information about the Oracle environment.Prior to the Oracle8i database, the EM software had to be installed on Windows 95/98 or NT-based systems and each repository could be accessed by only a single database manager at a time. Now you can use EM from a browser or load it onto Windows 95/98/2000 or NT-based systems. Multiple database administrators can access the EM repository at the same time. In the EM repository for Oracle9i, the super administrator can define services that should be displayed on other administrators’consoles, and management regions can be set up.2. Add-on packsSeveral optional add-on packs are available for Oracle, as described in the following sections. In addition to these database-management packs, management packs are available for Oracle Applications and for SAP R/3.(1) standard Management PackThe Standard Management Pack for Oracle provides tools for the management of small Oracle databases (e.g., Oracle Server/Standard Edition). Features include support for performance monitoring of database contention, I/O, load, memory use and instance metrics, session analysis, index tuning, and change investigation and tracking.(2) Diagnostics PackYou can use the Diagnostic Pack to monitor, diagnose, and maintain the health of Enterprise Edition databases, operating systems, and applications. With both historical and real-time analysis, you can automatically avoid problems before theyoccur. The pack also provides capacity planning features that help you plan and track future system-resource requirements.(3)Tuning PackWith the Tuning Pack, you can optimise system performance by identifying and tuning Enterprise Edition databases and application bottlenecks such as inefficient SQL, poor data design, and the improper use of system resources. The pack can proactively discover tuning opportunities and automatically generate the analysis and required changes to tune the systems.(4) Change Management PackThe Change Management Pack helps eliminate errors and loss of data when upgrading Enterprise Edition databases to support new applications. It impact and complex dependencies associated with application changes and automatically perform database upgrades. Users can initiate changes with easy-to-use wizards that teach the systematic steps necessary to upgrade.(5) AvailabilityOracle Enterprise Manager can be used for managing Oracle Standard Edition and/or Enterprise Edition. Additional functionality is provided by separate Diagnostics, Tuning, and Change Management Packs.3. Backup and RecoveryAs every database administrator knows, backing up a database is a rather mundane but necessary task. An improper backup makes recovery difficult, if not impossible. Unfortunately, people often realize the extreme importance of this everyday task only when it is too late –usually after losing business-critical data due to a failure of a related system.The following sections describe some products and techniques for performing database backup operations.(1) Recovery ManagerTypical backups include complete database backups (the most common type), database backups, control file backups, and recovery of the database. Previously,Oracle’s Enterprise Backup Utility (EBU) provided a similar solution on some platforms. However, RMAN, with its Recovery Catalog stored in an Oracle database, provides a much more complete solution. RMAN can automatically locate, back up, restore, and recover databases, control files, and archived redo logs. RMAN for Oracle9i can restart backups and restores and implement recovery window policies when backups expire. The Oracle Enterprise Manager Backup Manager provides a GUI-based interface to RMAN.(2) Incremental backup and recoveryRMAN can perform incremental backups of Enterprise Edition databases. Incremental backups back up only the blocks modified since the last backup of a datafile, tablespace, or database; thus, they’re smaller and faster than complete backups. RMAN can also perform point-in-time recovery, which allows the recovery of data until just prior to a undesirable event.(3) Legato Storage ManagerVarious media-management software vendors support RMAN. Oracle bundles Legato Storage Manager with Oracle to provide media-management services, including the tracking of tape volumes, for up to four devices. RMAN interfaces automatically with the media-management software to request the mounting of tapes as needed for backup and recovery operations.(4)AvailabilityWhile basic recovery facilities are available for both Oracle Standard Edition and Enterprise Edition, incremental backups have typically been limited to Enterprise Edition.Data IndependenceAn important point about database systems is that the database should exist independently of any of the specific applications. Traditional data processing applications are data dependent. COBOL programs contain file descriptions and record descriptions that carefully describe the format and characteristics of the data.Users should be able to change the structure of the database without affecting the applications that use it. For example, suppose that the requirements of yourapplications change. A simple example would be expanding ZIP codes from five digits to nine digits. On a traditional approach using COBOL programs each individual COBOL application program that used that particular field would have to be changed, recompiled, and retested. The programs would be unable to recognize or access a file that had been changed and contained a new data description; this, in turn, might cause disruption in processing unless the change were carefully planned.Most database programs provide the ability to change the database structure by simply changing the ZIP code field and the data-entry form. In this case, data independence allows for minimal disruption of current and existing applications. Users can continue to work and can even ignore the nine-digit code if they choose. Eventually, the file will be converted to the new nine-digit ZIP code, but the ease with which the changeover takes place emphasizes the importance of data independence.Data IntegrityData integrity refers to the accuracy, correctness, or validity of the data in the database. In a database system, data integrity means safeguarding the data against invalid alteration or destruction arise. The first has to do with many users accessing the database concurrently. For example, if thousands of travel agents and airline reservation clerks are accessing the database concurrently. For example, if thousands of travel agents and airline reservation clerks are accessing the same database at once, and two agents book the same seat on the same flight, the first agent’s booking will be lost. In such case the technique of locking the record or field provides the means for preventing one user from accessing a record while another user is updating the same record.The second complication relates to hardwires, software, or human error during the course of processing and involves database transactions treated as a single . For example, an agent booking an airline reservation involves several database updates (i.e., adding the passenger’s name and address and updating the seats-available field), which comprise a single transaction. The database transaction is not considered to be completed until all updates have been completed; otherwise, none of the updates will be allowed to take place.Data SecurityData security refers to the protection of a database against unauthorized or illegal access or modification. For example, a high-level password might allow a user to read from, write to, and modify the database structure, whereas a low-level password history of the modifications to a database-can be used to identify where and when a database was tampered with and it can also be used to restore the file to its original condition.三、Choosing between Oracle and SQL ServerI have to decide between using the Oracle database and WebDB vs. Microsoft SQL Server with Visual Studio. This choice will guide our future Web projects. What are the strong points of each of these combinations and what are the negatives?Lori: Making your decision will depend on what you already have. For instance, if you want to implement a Web-based database application and you are a Windows-only shop, SQL Server and the Visual Studio package would be fine. But the Oracle solution would be better with mixed platforms.There are other things to consider, such as what extras you get and what skills are required. WebDB is a content management and development tool that can be used by content creators, database administrators, and developers without any programming experience. WebDB is a browser-based tool that helps ease content creation and provides monitoring and maintenance tools. This is a good solution for organizations already using Oracle. Oracle also scales better than SQL Server, but you will need to have a competent Oracle administrator on hand.The SQL Sever/Visual Studio approach is more difficult to use and requires an experienced object-oriented programmer or some extensive training. However, you do get a fistful of development tools with Visual Studio: Visual Basic, Visual C++, and Visual InterDev for only $1,619. Plus, you will have to add the cost of the SQL Server, which will run you $1,999 for 10 clients or $3,999 for 25 clients-a less expensive solution than Oracle’s.Oracle also has a package solution that starts at $6,767, depending on the platform selected. The suite includes not only WebDB and Oracle8i butalso other tools for development such as the Oracle application server, JDeveloper, and Workplace Templates, and the suite runs on more platforms than the Microsoft solution does. This can be a good solution if you are a start-up or a small to midsize business. Buying these tools in a package is less costly than purchasing them individually.Much depends on your skill level, hardware resources, and budget. I hope this helps in your decision-making.Brooks: I totally agree that this decision depends in large part on what infrastructure and expertise you already have. If the decision is close, you need to figure out who’s going to be doing the work and what your priorities are.These two products have different approaches, and they reflect the different personalities of the two vendors. In general, Oracle products are designed for very professional development efforts by top-notch programmers and project leaders. The learning period is fairly long, and the solution is pricey; but if you stick it out you will ultimately have greater scalability and greater reliability.If your project has tight deadlines and you don’t have the time and/or money to hire a team of very expensive, very experienced developers, you may find that the Oracle solution is an easy way to get yourself in trouble. There’s nothing worse than a poorly developed Oracle application.What Microsoft offers is a solution that’s aimed at rapid development and low-cost implementation. The tools are cheaper, the servers you’ll run it on are cheaper, and the developers you need will be cheaper. Choosing SQL Sever and Visual Studio is an excellent way to start fast.Of course, there are trade-offs. The key problem I have with Visual Studio and SQL Server is that you’ll be tied to Microsoft operating systems and Intel hardware. If the day comes when you need to support hundreds of thousands of users, you really don’t have anywhere to go other than buying hundreds of servers, which is a management nightmare.If you go with the Microsoft approach, it sounds like you may not need morethan Visual Interdev. If you already know that you’re going to be developing ActiveX components in Visual Basic or Visual C++, that’s warning sign that maybe you should look at the Oracle solution more closely.I want to emphasize that, although these platforms have their relative strengths and weaknesses, if you do it right you can build a world-class application on either one. So if you have an organizational bias toward one of the vendors, by all means go with it. If you’re starting out from scratch, you’re going to have to ask yourself whether your organization leans more toward perfectionism or pragmatism, and realize that both “isms”have their faults.中文译文:数据库管理数据库(也称DataBase)也称为电子数据库,是指由计算机特别组织的用下快速查找和检索的任意的数据或信息集合。

数据库中英文对照表

数据库中英文对照表

DBA词典:数据库设计常用词汇中英文对照表1. Access method(访问方法):此步骤包括从文件中存储和检索记录。

2. Alias(别名):某属性的另一个名字。

在SQL中,可以用别名替换表名。

3. Alternate keys(备用键,ER/关系模型):在实体/表中没有被选为主健的候选键。

4. Anomalies(异常)参见更新异常(update anomalies)5. Application design(应用程序设计):数据库应用程序生命周期的一个阶段,包括设计用户界面以及使用和处理数据库的应用程序。

6. Attribute(属性)(关系模型):属性是关系中命名的列。

7. Attribute(属性)(ER模型):实体或关系中的一个性质。

8. Attribute inheritance(属性继承):子类成员可以拥有其特有的属性,并且继承那些与超类有关的属性的过程。

9. Base table(基本表):一个命名的表,其记录物理的存储在数据库中。

10. Binary relationship(二元关系):一个ER术语,用于描述两个实体间的关系。

例如,panch Has Staff。

11. Bottom-up approach(自底向上方法):用于数据库设计,一种设计方法学,他从标识每个设计组建开始,然后将这些组件聚合成一个大的单元。

在数据库设计中,可以从表示属性开始底层设计,然后将这些属性组合在一起构成代表实体和关系的表。

12. Business rules(业务规则):由用户或数据库的管理者指定的附加规则。

13. Candidate key(候选键,ER关系模型):仅包含唯一标识实体所必须得最小数量的属性/列的超键。

14. Cardinality(基数):描述每个参与实体的可能的关系数目。

15. Centralized approach(集中化方法,用于数据库设计):将每个用户试图的需求合并成新数据库应用程序的一个需求集合16. Chasm trap(深坑陷阱):假设实体间存在一根,但某些实体间不存在通路。

计算机科学与技术专业外文翻译--数据库

计算机科学与技术专业外文翻译--数据库

外文原文:Database1.1Database conceptThe database concept has evolved since the 1960s to ease increasing difficulties in designing, building, and maintaining complex information systems (typically with many concurrent end-users, and with a large amount of diverse data). It has evolved together with database management systems which enable the effective handling of databases. Though the terms database and DBMS define different entities, they are inseparable: a database's properties are determined by its supporting DBMS and vice-versa. The Oxford English dictionary cites[citation needed] a 1962 technical report as the first to use the term "data-base." With the progress in technology in the areas of processors, computer memory, computer storage and computer networks, the sizes, capabilities, and performance of databases and their respective DBMSs have grown in orders of magnitudes. For decades it has been unlikely that a complex information system can be built effectively without a proper database supported by a DBMS. The utilization of databases is now spread to such a wide degree that virtually every technology and product relies on databases and DBMSs for its development and commercialization, or even may have such embedded in it. Also, organizations and companies, from small to large, heavily depend on databases for their operations.No widely accepted exact definition exists for DBMS. However, a system needs to provide considerable functionality to qualify as a DBMS. Accordingly its supported data collection needs to meet respective usability requirements (broadly defined by the requirements below) to qualify as a database. Thus, a database and its supporting DBMS are defined here by a set of general requirements listed below. Virtually all existing mature DBMS products meet these requirements to a great extent, while less mature either meet them or converge to meet them.1.2Evolution of database and DBMS technologyThe introduction of the term database coincided with the availability of direct-access storage (disks and drums) from the mid-1960s onwards. The term represented a contrast with the tape-based systems of the past, allowing shared interactive use rather than daily batch processing.In the earliest database systems, efficiency was perhaps the primary concern, but it was already recognized that there were other important objectives. One of the key aims was to make the data independent of the logic of application programs, so that the same data could be made available to different applications.The first generation of database systems were navigational,[2] applications typically accessed data by following pointers from one record to another. The two main data models at this time were the hierarchical model, epitomized by IBM's IMS system, and the Codasyl model (Network model), implemented in a number ofproducts such as IDMS.The Relational model, first proposed in 1970 by Edgar F. Codd, departed from this tradition by insisting that applications should search for data by content, rather than by following links. This was considered necessary to allow the content of the database to evolve without constant rewriting of applications. Relational systems placed heavy demands on processing resources, and it was not until the mid 1980s that computing hardware became powerful enough to allow them to be widely deployed. By the early 1990s, however, relational systems were dominant for all large-scale data processing applications, and they remain dominant today (2012) except in niche areas. The dominant database language is the standard SQL for the Relational model, which has influenced database languages also for other data models.Because the relational model emphasizes search rather than navigation, it does not make relationships between different entities explicit in the form of pointers, but represents them rather using primary keys and foreign keys. While this is a good basis for a query language, it is less well suited as a modeling language. For this reason a different model, the Entity-relationship model which emerged shortly later (1976), gained popularity for database design.In the period since the 1970s database technology has kept pace with the increasing resources becoming available from the computing platform: notably the rapid increase in the capacity and speed (and reduction in price) of disk storage, and the increasing capacity of main memory. This has enabled ever larger databases and higher throughputs to be achieved.The rigidity of the relational model, in which all data is held in tables with a fixed structure of rows and columns, has increasingly been seen as a limitation when handling information that is richer or more varied in structure than the traditional 'ledger-book' data of corporate information systems: for example, document databases, engineering databases, multimedia databases, or databases used in the molecular sciences. Various attempts have been made to address this problem, many of them gathering under banners such as post-relational or NoSQL. Two developments of note are the Object database and the XML database. The vendors of relational databases have fought off competition from these newer models by extending the capabilities of their own products to support a wider variety of data types.1.3General-purpose DBMSA DBMS has evolved into a complex software system and its development typically requires thousands of person-years of development effort.[citation needed] Some general-purpose DBMSs, like Oracle, Microsoft SQL Server, and IBM DB2, have been undergoing upgrades for thirty years or more. General-purpose DBMSs aim to satisfy as many applications as possible, which typically makes them even more complex than special-purpose databases. However, the fact that they can be used "off the shelf", as well as their amortized cost over many applications and instances, makes them an attractive alternative (Vsone-time development) whenever they meet an application's requirements.Though attractive in many cases, a general-purpose DBMS is not always the optimal solution: When certain applications are pervasive with many operating instances, each with many users, a general-purpose DBMS may introduce unnecessary overhead and too large "footprint" (too large amount of unnecessary, unutilized software code). Such applications usually justify dedicated development.Typical examples are email systems, though they need to possess certain DBMS properties: email systems are built in a way that optimizes email messages handling and managing, and do not need significant portions of a general-purpose DBMS functionality.1.4Database machines and appliancesIn the 1970s and 1980s attempts were made to build database systems with integrated hardware and software. The underlying philosophy was that such integration would provide higher performance at lower cost. Examples were IBM System/38, the early offering of Teradata, and the Britton Lee, Inc. database machine. Another approach to hardware support for database management was ICL's CAFS accelerator, a hardware disk controller with programmable search capabilities. In the long term these efforts were generally unsuccessful because specialized database machines could not keep pace with the rapid development and progress of general-purpose computers. Thus most database systems nowadays are software systems running on general-purpose hardware, using general-purpose computer data storage. However this idea is still pursued for certain applications by some companies like Netezza and Oracle (Exadata).1.5Database researchDatabase research has been an active and diverse area, with many specializations, carried out since the early days of dealing with the database concept in the 1960s. It has strong ties with database technology and DBMS products. Database research has taken place at research and development groups of companies (e.g., notably at IBM Research, who contributed technologies and ideas virtually to any DBMS existing today), research institutes, and Academia. Research has been done both through Theory and Prototypes. The interaction between research and database related product development has been very productive to the database area, and many related key concepts and technologies emerged from it. Notable are the Relational and the Entity-relationship models, the Atomic transaction concept and related Concurrency control techniques, Query languages and Query optimization methods, RAID, and more. Research has provided deep insight to virtually all aspects of databases, though not always has been pragmatic, effective (and cannot and should not always be: research is exploratory in nature, and not always leads to accepted or useful ideas). Ultimately market forces and real needs determine the selection of problem solutions and related technologies, also among those proposed by research. However, occasionally, not the best and most elegant solution wins (e.g., SQL). Along their history DBMSs and respective databases, to a great extent, have been the outcome of such research, while real product requirements and challenges triggered database research directions and sub-areas.The database research area has several notable dedicated academic journals (e.g., ACM Transactions on Database Systems-TODS, Data and Knowledge Engineering-DKE, and more) and annual conferences (e.g., ACM SIGMOD, ACM PODS, VLDB, IEEE ICDE, and more), as well as an active and quite heterogeneous (subject-wise) research community all over the world.1.6Database architectureDatabase architecture (to be distinguished from DBMS architecture; see below) may be viewed, to some extent, as an extension of Data modeling. It is used to conveniently answer requirements of different end-users from a same database, as well as for other benefits. For example, a financial department of a company needs the payment details of all employees as part of the company's expenses, but not other many details about employees, that are the interest of the human resources department. Thus different departments need different views of the company's database, that both include the employees' payments, possibly in a different level of detail (and presented in different visual forms). To meet such requirement effectively database architecture consists of three levels: external, conceptual and internal. Clearly separating the three levels was a major feature of the relational database model implementations that dominate 21st century databases.[13]The external level defines how each end-user type understands the organization of its respective relevant data in the database, i.e., the different needed end-user views.A single database can have any number of views at the external level.The conceptual level unifies the various external views into a coherent whole, global view.[13] It provides the common-denominator of all the external views. It comprises all the end-user needed generic data, i.e., all the data from which any view may be derived/computed. It is provided in the simplest possible way of such generic data, and comprises the back-bone of the database. It is out of the scope of the various database end-users, and serves database application developers and defined by database administrators that build the database.The Internal level (or Physical level) is as a matter of fact part of the database implementation inside a DBMS (see Implementation section below). It is concerned with cost, performance, scalability and other operational matters. It deals with storage layout of the conceptual level, provides supporting storage-structures like indexes, to enhance performance, and occasionally stores data of individual views (materialized views), computed from generic data, if performance justification exists for such redundancy. It balances all the external views' performance requirements, possibly conflicting, in attempt to optimize the overall database usage by all its end-uses according to the database goals and priorities.All the three levels are maintained and updated according to changing needs by database administrators who often also participate in the database design.The above three-level database architecture also relates to and being motivated by the concept of data independence which has been described for long time as a desired database property and was one of the major initial driving forces of the Relational model. In the context of the above architecture it means that changes made at a certain level do not affect definitions and software developed with higher level interfaces, and are being incorporated at the higher level automatically. For example, changes in the internal level do not affect application programs written using conceptual level interfaces, which saves substantial change work that would be needed otherwise.In summary, the conceptual is a level of indirection between internal and external. On one hand it provides a common view of the database, independent of different external view structures, and on the other hand it is uncomplicated by details of how the data is stored or managed (internal level). In principle every level, and even every external view, can be presented by a different data model. In practice usually a given DBMS uses the same data model for both the external and the conceptual levels (e.g., relational model). The internal level, which is hidden inside the DBMS and depends on its implementation (see Implementation section below), requires a different levelof detail and uses its own data structure types, typically different in nature from the structures of the external and conceptual levels which are exposed to DBMS users (e.g., the data models above): While the external and conceptual levels are focused on and serve DBMS users, the concern of the internal level is effective implementation details.中文译文:数据库1.1 数据库的概念数据库的概念已经演变自1960年以来,以缓解日益困难,在设计,建设,维护复杂的信息系统(通常与许多并发的最终用户,并用大量不同的数据)。

外文翻译原文—数据库

外文翻译原文—数据库

DatabaseA database consists of an organized collection of data for one or more uses, typically in digital form. One way of classifying databases involves the type of their contents, for example: bibliographic, document-text, statistical. Digital databases are managed using database management systems, which store database contents, allowing data creation and maintenance, and search and other access. ArchitectureDatabase architecture consists of three levels, external, conceptual and internal. Clearly separating the three levels was a major feature of the relational database model that dominates 21st century databases.The external level defines how users understand the organization of the data. A single database can have any number of views at the external level. The internal level defines how the data is physically stored and processed by the computing system. Internal architecture is concerned with cost, performance, scalability and other operational matters. The conceptual is a level of indirection between internal and external. It provides a common view of the database that is uncomplicated by details of how the data is stored or managed, and that can unify the various external views into a coherent whole.Database management systemsA database management system (DBMS) consists of software that operates databases, providing storage, access, security, backup and other facilities. Database management systems can be categorized according to the database model that they support, such as relational or XML, the type(s) of computer they support, such as a server cluster or a mobile phone, the query language(s) that access the database, such as SQL or XQuery, performance trade-offs, such as maximum scale or maximum speed or others. Some DBMS cover more than one entry in these categories, e.g., supporting multiple query languages.Components of DBMSMost DBMS as of 2009[update] implement a relational model. Other DBMS systems, such as Object DBMS, offer specific features for more specialized requirements. Their components are similar, but not identical.RDBMS components•Sublanguages—Relational DBMS (RDBMS) include Data Definition Language (DDL) for defining the structure of the database, Data Control Language (DCL) for defining security/access controls, and Data Manipulation Language (DML) for querying and updating data.•Interface drivers—These drivers are code libraries that provide methods to prepare statements, execute statements, fetch results, etc. Examples include ODBC, JDBC, MySQL/PHP, FireBird/Python.•SQL engine—This component interprets and executes the DDL, DCL, and DML statements.It includes three major components (compiler, optimizer, and executor).•Transaction engine—Ensures that multiple SQL statements either succeed or fail as a group, according to application dictates.•Relational engine—Relational objects such as Table, Index, and Referential integrity constraints are implemented in this component.•Storage engine—This component stores and retrieves data from secondary storage, as well asmanaging transaction commit and rollback, backup and recovery, etc.ODBMS componentsObject DBMS (ODBMS) has transaction and storage components that are analogous to those in an RDBMS. Some ODBMS handle DDL, DCL and update tasks differently. Instead of using sublanguages, they provide APIs for these purposes. They typically include a sublanguage and accompanying engine for processing queries with interpretive statements analogous to but not the same as SQL. Example object query languages are OQL, LINQ, JDOQL, JPAQL and others. The query engine returns collections of objects instead of relational rows.TypesOperational databaseThese databases store detailed data about the operations of an organization. They are typically organized by subject matter, process relatively high volumes of updates using transactions. Essentially every major organization on earth uses such databases. Examples include customer databases that record contact, credit, and demographic information about a business' customers, personnel databases that hold information such as salary, benefits, skills data about employees, manufacturing databases that record details about product components, parts inventory, and financial databases that keep track of the organization's money, accounting and financial dealings.Data warehouseData warehouses archive historical data from operational databases and often from external sources such as market research firms. Often operational data undergoes transformation on its way into the warehouse, getting summarized, anonymized, reclassified, etc. The warehouse becomes the central source of data for use by managers and other end-users who may not have access to operational data. For example, sales data might be aggregated to weekly totals and converted from internal product codes to use UPC codes so that it can be compared with ACNielsen data. Analytical databaseAnalysts may do their work directly against a data warehouse, or create a separate analytic database for Online Analytical Processing. For example, a company might extract sales records for analyzing the effectiveness of advertising and other sales promotions at an aggregate level. Distributed databaseThese are databases of local work-groups and departments at regional offices, branch offices, manufacturing plants and other work sites. These databases can include segments of both common operational and com mon user databases, as well as data generated and used only at a user’s own site. End-user databaseThese databases consist of data developed by individual end-users. Examples of these are collections of documents in spreadsheets, word processing and downloaded files, or even managing their personal baseball card collection.External databaseThese databases contain data collect for use across multiple organizations, either freely or via subscription. The Internet Movie Database is one example.Hypermedia databasesThe Worldwide web can be thought of as a database, albeit one spread across millions of independent computing systems. Web browsers "process" this data one page at a time, while web crawlers and other software provide the equivalent of database indexes to support search and otheractivities.ModelsPost-relational database modelsProducts offering a more general data model than the relational model are sometimes classified as post-relational. Alternate terms include "hybrid database", "Object-enhanced RDBMS" and others. The data model in such products incorporates relations but is not constrained by E.F. Codd's Information Principle, which requires that all information in the database must be cast explicitly in terms of values in relations and in no other way.Some of these extensions to the relational model integrate concepts from technologies that pre-date the relational model. For example, they allow representation of a directed graph with trees on the nodes.Some post-relational products extend relational systems with non-relational features. Others arrived in much the same place by adding relational features to pre-relational systems. Paradoxically, this allows products that are historically pre-relational, such as PICK and MUMPS, to make a plausible claim to be post-relational.Object database modelsIn recent years[update], the object-oriented paradigm has been applied in areas such as engineering and spatial databases, telecommunications and in various scientific domains. The conglomeration of object oriented programming and database technology led to this new kind of database. These databases attempt to bring the database world and the application-programming world closer together, in particular by ensuring that the database uses the same type system as the application program. This aims to avoid the overhead (sometimes referred to as the impedance mismatch) of converting information between its representation in the database (for example as rows in tables) and its representation in the application program (typically as objects). At the same time, object databases attempt to introduce key ideas of object programming, such as encapsulation and polymorphism, into the world of databases.A variety of these ways have been tried for storing objects in a database. Some products have approached the problem from the application-programming side, by making the objects manipulated by the program persistent. This also typically requires the addition of some kind of query language, since conventional programming languages do not provide language-level functionality for finding objects based on their information content. Others have attacked the problem from the database end, by defining an object-oriented data model for the database, and defining a database programming language that allows full programming capabilities as well as traditional query facilities. Storage structuresDatabases may store relational tables/indexes in memory or on hard disk in one of many forms: •ordered/unordered flat files•ISAM•heaps•hash buckets•logically-blocked files•B+ treesThe most commonly used are B+ trees and ISAM.Object databases use a range of storage mechanisms. Some use virtual memory-mapped files tomake the native language (C++, Java etc.) objects persistent. This can be highly efficient but it can make multi-language access more difficult. Others disassemble objects into fixed- and varying-length components that are then clustered in fixed sized blocks on disk and reassembled into the appropriate format on either the client or server address space. Another popular technique involves storing the objects in tuples (much like a relational database) which the database server then reassembles into objects for the client.Other techniques include clustering by category (such as grouping data by month, or location), storing pre-computed query results, known as materialized views, partitioning data by range (e.g., a data range) or by hash.Memory management and storage topology can be important design choices for database designers as well. Just as normalization is used to reduce storage requirements and improve database designs, conversely denormalization is often used to reduce join complexity and reduc e query execution time.IndexingIndexing is a technique for improving database performance. The many types of index share the common property that they eliminate the need to examine every entry when running a query. In large databases, this can reduce query time/cost by orders of magnitude. The simplest form of index is a sorted list of values that can be searched using a binary search with an adjacent reference to the location of the entry, analogous to the index in the back of a book. The same data can have multiple indexes (an employee database could be indexed by last name and hire date.)Indexes affect performance, but not results. Database designers can add or remove indexes without changing application logic, reducing maintenance costs as the database grows and database usage evolves.Given a particular query, the DBMS' query optimizer is responsible for devising the most efficient strategy for finding matching data. The optimizer decides which index or indexes to use, how to combine data from different parts of the database, how to provide data in the order requested, etc.Indexes can speed up data access, but they consume space in the database, and must be updated each time the data are altered. Indexes therefore can speed data access but slow data maintenance. These two properties determine whether a given index is worth the cost.TransactionsMost DBMS provide some form of support for transactions, which allow multiple data items to be updated in a consistent fashion, such that updates that are part of a transaction succeed or fail in unison. The so-called ACID rules, summarized here, characterize this behavior:•Atomicity: Either all the data changes in a transaction must happen, or none of them. The transaction must be completed, or else it must be undone (rolled back).•Consistency: Every transaction must preserve the declared consistency rules for the database. •Isolation: Two concurrent transactions cannot interfere with one another. Intermediate results within one transaction must remain invisible to other transactions. The most extreme form of isolation is serializability, meaning that transactions that take place concurrently could instead be performed in some series, without affecting the ultimate result.•Durability: Completed transactions cannot be aborted later or their results discarded. They must persist through (for instance) DBMS restarts.In practice, many DBMSs allow the selective relaxation of these rules to balance perfect behavior with optimum performance.ReplicationDatabase replication involves maintaining multiple copies of a database on different computers, to allow more users to access it, or to allow a secondary site to immediately take over if the primary site stops working. Some DBMS piggyback replication on top of their transaction logging facility, applying the primary's log to the secondary in near real-time. Database clustering is a related concept for handling larger databases and user communities by employing a cluster of multiple computers to host a single database that can use replication as part of its approach.SecurityDatabase security denotes the system, processes, and procedures that protect a database from unauthorized activity.DBMSs usually enforce security through access control, auditing, and encryption:•Access control manages who can connect to the database via authentication and what they can do via authorization.•Auditing records information about database activity: who, what, when, and possibly where. •Encryption protects data at the lowest possible level by storing and possibly transmitting data in an unreadable form. The DBMS encrypts data when it is added to the database and decrypts it when returning query results. This process can occur on the client side of a network connection to prevent unauthorized access at the point of use.ConfidentialityLaw and regulation governs the release of information from some databases, protecting medical history, driving records, telephone logs, etc.In the United Kingdom, database privacy regulation falls under the Office of the Information Commissioner. Organizations based in the United Kingdom and holding personal data in digital format such as databases must register with the Office.LockingWhen a transaction modifies a resource, the DBMS stops other transactions from also modifying it, typically by locking it. Locks also provide one method of ensuring that data does not c hange while a transaction is reading it or even that it doesn't change until a transaction that once read it has completed.GranularityLocks can be coarse, covering an entire database, fine-grained, covering a single data item, or intermediate covering a collection of data such as all the rows in a RDBMS table.Lock typesLocks can be shared or exclusive, and can lock out readers and/or writers. Locks can be created implicitly by the DBMS when a transaction performs an operation, or explic itly at the transaction's request.Shared locks allow multiple transactions to lock the same resource. The lock persists until all such transactions complete. Exclusive locks are held by a single transaction and prevent other transactions from locking the same resource.Read locks are usually shared, and prevent other transactions from modifying the resource. Write locks are exclusive, and prevent other transactions from modifying the resource. On some systems, write locks also prevent other transactions from reading the resource.The DBMS implicitly locks data when it is updated, and may also do so when it is read.Transactions explicitly lock data to ensure that they can complete without a deadlock or other complication. Explic it locks may be useful for some administrative tasks.Locking can significantly affect database performance, especially with large and complex transactions in highly concurrent environments.IsolationIsolation refers to the ability of one transaction to see the results of other transactions. Greater isolation typically reduces performance and/or concurrency, leading DBMSs to provide administrative options to reduce isolation. For example, in a database that analyzes trends rather than looking at low-level detail, increased performance might justify allowing readers to see uncommitted changes ("dirty reads".)DeadlocksDeadlocks occur when two transactions each require data that the other has already locked exclusively. Deadlock detection is performed by the DBMS, which then aborts one of the transactions and allows the other to complete.From: Wikipedia, the free encyclopedia。

计算机专业外文翻译+原文-数据库管理系统介绍

计算机专业外文翻译+原文-数据库管理系统介绍

外文资料Database Management SystemsA database (sometimes spelled data base) is also called an electronic database , referring to any collection of data, or information, that is specially organized for rapid search and retrieval by a computer. Databases are structured to facilitate the storage, retrieval , modification, and deletion of data in conjunction with various data-processing operations .Databases can be stored on magnetic disk or tape, optical disk, or some other secondary storage device.A database consists of a file or a set of files. The information in these files may be broken down into records, each of which consists of one or more fields. Fields are the basic units of data storage , and each field typically contains information pertaining to one aspect or attribute of the entity described by the database . Using keywords and various sorting commands, users can rapidly search , rearrange, group, and select the fields in many records to retrieve or create reports on particular aggregate of data.Complex data relationships and linkages may be found in all but the simplest databases .The system software package that handles the difficult tasks associated with creating ,accessing, and maintaining database records is called a database management system(DBMS).The programs in a DBMS package establish an interface between the database itself and the users of the database.. (These users may be applications programmers, managers and others with information needs, and various OS programs.)A DBMS can organize, process, and present selected data elements form the database. This capability enables decision makers to search, probe, and query database contents in order to extract answers to nonrecurring and unplanned questions that aren’t available in regular reports. These questions might initially be vague and/or poorly defined ,but people can “browse”through the database until they have the needed information. In short, the DBMS will “manage” the stored data items and assemble the needed itemsfrom the common database in response to the queries of those who aren’t programmers.A database management system (DBMS) is composed of three major parts:(1)a storage subsystem that stores and retrieves data in files;(2) a modeling and manipulation subsystem that provides the means with which to organize the data and to add , delete, maintain, and update the data;(3)and an interface between the DBMS and its users. Several major trends are emerging that enhance the value and usefulness of database management systems;Managers: who require more up-to-data information to make effective decisionCustomers: who demand increasingly sophisticated information services and more current information about the status of their orders, invoices, and accounts.Users: who find that they can develop custom applications with database systems in a fraction of the time it takes to use traditional programming languages.Organizations : that discover information has a strategic value; they utilize their database systems to gain an edge over their competitors.The Database ModelA data model describes a way to structure and manipulate the data in a database. The structural part of the model specifies how data should be represented(such as tree, tables, and so on ).The manipulative part of the model specifies the operation with which to add, delete, display, maintain, print, search, select, sort and update the data.Hierarchical ModelThe first database management systems used a hierarchical model-that is-they arranged records into a tree structure. Some records are root records and all others have unique parent records. The structure of the tree is designed to reflect the order in which the data will be used that is ,the record at the root of a tree will be accessed first, then records one level below the root ,and so on.The hierarchical model was developed because hierarchical relationships are commonly found in business applications. As you have known, an organization char often describes a hierarchical relationship: topmanagement is at the highest level, middle management at lower levels, and operational employees at the lowest levels. Note that within a strict hierarchy, each level of management may have many employees or levels of employees beneath it, but each employee has only one manager. Hierarchical data are characterized by this one-to-many relationship among data.In the hierarchical approach, each relationship must be explicitly defined when the database is created. Each record in a hierarchical database can contain only one key field and only one relationship is allowed between any two fields. This can create a problem because data do not always conform to such a strict hierarchy.Relational ModelA major breakthrough in database research occurred in 1970 when E.F. Codd proposed a fundamentally different approach to database management called relational model ,which uses a table as its data structure.The relational database is the most widely used database structure. Data is organized into related tables. Each table is made up of rows called and columns called fields. Each record contains fields of data about some specific item. For example, in a table containing information on employees, a record would contain fields of data such as a person’s last name ,first name ,and street address.Structured query language(SQL)is a query language for manipulating data in a relational database .It is nonprocedural or declarative, in which the user need only specify an English-like description that specifies the operation and the described record or combination of records. A query optimizer translates the description into a procedure to perform the database manipulation.Network ModelThe network model creates relationships among data through a linked-list structure in which subordinate records can be linked to more than one parent record. This approach combines records with links, which are called pointers. The pointers are addresses that indicate the location of a record. With the network approach, a subordinate record can be linked to a key record and at the same time itself be a key record linked to other sets of subordinate records. The network mode historically has had a performanceadvantage over other database models. Today , such performance characteristics are only important in high-volume ,high-speed transaction processing such as automatic teller machine networks or airline reservation system.Both hierarchical and network databases are application specific. If a new application is developed ,maintaining the consistency of databases in different applications can be very difficult. For example, suppose a new pension application is developed .The data are the same, but a new database must be created.Object ModelThe newest approach to database management uses an object model , in which records are represented by entities called objects that can both store data and provide methods or procedures to perform specific tasks.The query language used for the object model is the same object-oriented programming language used to develop the database application .This can create problems because there is no simple , uniform query language such as SQL . The object model is relatively new, and only a few examples of object-oriented database exist. It has attracted attention because developers who choose an object-oriented programming language want a database based on an object-oriented model.Distributed DatabaseSimilarly , a distributed database is one in which different parts of the database reside on physically separated computers . One goal of distributed databases is the access of information without regard to where the data might be stored. Keeping in mind that once the users and their data are separated , the communication and networking concepts come into play .Distributed databases require software that resides partially in the larger computer. This software bridges the gap between personal and large computers and resolves the problems of incompatible data formats. Ideally, it would make the mainframe databases appear to be large libraries of information, with most of the processing accomplished on the personal computer.A drawback to some distributed systems is that they are often based on what is called a mainframe-entire model , in which the larger host computeris seen as the master and the terminal or personal computer is seen as a slave. There are some advantages to this approach . With databases under centralized control , many of the problems of data integrity that we mentioned earlier are solved . But today’s personal computers, departmental computers, and distributed processing require computers and their applications to communicate with each other on a more equal or peer-to-peer basis. In a database, the client/server model provides the framework for distributing databases.One way to take advantage of many connected computers running database applications is to distribute the application into cooperating parts that are independent of one anther. A client is an end user or computer program that requests resources across a network. A server is a computer running software that fulfills those requests across a network . When the resources are data in a database ,the client/server model provides the framework for distributing database.A file serve is software that provides access to files across a network. A dedicated file server is a single computer dedicated to being a file server. This is useful ,for example ,if the files are large and require fast access .In such cases, a minicomputer or mainframe would be used as a file server. A distributed file server spreads the files around on individual computers instead of placing them on one dedicated computer.Advantages of the latter server include the ability to store and retrieve files on other computers and the elimination of duplicate files on each computer. A major disadvantage , however, is that individual read/write requests are being moved across the network and problems can arise when updating files. Suppose a user requests a record from a file and changes it while another user requests the same record and changes it too. The solution to this problems called record locking, which means that the first request makes others requests wait until the first request is satisfied . Other users may be able to read the record, but they will not be able to change it .A database server is software that services requests to a database across a network. For example, suppose a user types in a query for data on his or her personal computer . If the application is designed with the client/server model in mind ,the query language part on the personal computer simplesends the query across the network to the database server and requests to be notified when the data are found.Examples of distributed database systems can be found in the engineering world. Sun’s Network Filing System(NFS),for example, is used in computer-aided engineering applications to distribute data among the hard disks in a network of Sun workstation.Distributing databases is an evolutionary step because it is logical that data should exist at the location where they are being used . Departmental computers within a large corporation ,for example, should have data reside locally , yet those data should be accessible by authorized corporate management when they want to consolidate departmental data . DBMS software will protect the security and integrity of the database , and the distributed database will appear to its users as no different from the non-distributed database .In this information age, the data server has become the heart of a company. This one piece of software controls the rhythm of most organizations and is used to pump information lifeblood through the arteries of the network. Because of the critical nature of this application, the data server is also the one of the most popular targets for hackers. If a hacker owns this application, he can cause the company's "heart" to suffer a fatal arrest.Ironically, although most users are now aware of hackers, they still do not realize how susceptible their database servers are to hack attacks. Thus, this article presents a description of the primary methods of attacking database servers (also known as SQL servers) and shows you how to protect yourself from these attacks.You should note this information is not new. Many technical white papers go into great detail about how to perform SQL attacks, and numerous vulnerabilities have been posted to security lists that describe exactly how certain database applications can be exploited. This article was written for the curious non-SQL experts who do not care to know the details, and as a review to those who do use SQL regularly.What Is a SQL Server?A database application is a program that provides clients with access todata. There are many variations of this type of application, ranging from the expensive enterprise-level Microsoft SQL Server to the free and open source mySQL. Regardless of the flavor, most database server applications have several things in common.First, database applications use the same general programming language known as SQL, or Structured Query Language. This language, also known as a fourth-level language due to its simplistic syntax, is at the core of how a client communicates its requests to the server. Using SQL in its simplest form, a programmer can select, add, update, and delete information in a database. However, SQL can also be used to create and design entire databases, perform various functions on the returned information, and even execute other programs.To illustrate how SQL can be used, the following is an example of a simple standard SQL query and a more powerful SQL query:Simple: "Select * from dbFurniture.tblChair"This returns all information in the table tblChair from the database dbFurniture.Complex: "EXEC master..xp_cmdshell 'dir c:\'"This short SQL command returns to the client the list of files and folders under the c:\ directory of the SQL server. Note that this example uses an extended stored procedure that is exclusive to MS SQL Server.The second function that database server applications share is that they all require some form of authenticated connection between client and host. Although the SQL language is fairly easy to use, at least in its basic form, any client that wants to perform queries must first provide some form of credentials that will authorize the client; the client also must define the format of the request and response.This connection is defined by several attributes, depending on the relative location of the client and what operating systems are in use. We could spend a whole article discussing various technologies such as DSN connections, DSN-less connections, RDO, ADO, and more, but these subjects are outside the scope of this article. If you want to learn more about them, a little Google'ing will provide you with more than enough information. However, the following is a list of the more common itemsincluded in a connection request.Database sourceRequest typeDatabaseUser IDPasswordBefore any connection can be made, the client must define what type of database server it is connecting to. This is handled by a software component that provides the client with the instructions needed to create the request in the correct format. In addition to the type of database, the request type can be used to further define how the client's request will be handled by the server. Next comes the database name and finally the authentication information.All the connection information is important, but by far the weakest link is the authentication information—or lack thereof. In a properly managed server, each database has its own users with specifically designated permissions that control what type of activity they can perform. For example, a user account would be set up as read only for applications that need to only access information. Another account should be used for inserts or updates, and maybe even a third account would be used for deletes. This type of account control ensures that any compromised account is limited in functionality. Unfortunately, many database programs are set up with null or easy passwords, which leads to successful hack attacks.译文数据库管理系统介绍数据库(database,有时拼作data base)又称为电子数据库,是专门组织起来的一组数据或信息,其目的是为了便于计算机快速查询及检索。

计算机专业外文翻译+原文-数据库管理系统介绍

计算机专业外文翻译+原文-数据库管理系统介绍

外文资料Database Management SystemsA database (sometimes spelled data base) is also called an electronic database , referring to any collection of data, or information, that is specially organized for rapid search and retrieval by a computer. Databases are structured to facilitate the storage, retrieval , modification, and deletion of data in conjunction with various data-processing operations .Databases can be stored on magnetic disk or tape, optical disk, or some other secondary storage device.A database consists of a file or a set of files. The information in these files may be broken down into records, each of which consists of one or more fields. Fields are the basic units of data storage , and each field typically contains information pertaining to one aspect or attribute of the entity described by the database . Using keywords and various sorting commands, users can rapidly search , rearrange, group, and select the fields in many records to retrieve or create reports on particular aggregate of data.Complex data relationships and linkages may be found in all but the simplest databases .The system software package that handles the difficult tasks associated with creating ,accessing, and maintaining database records is called a database management system(DBMS).The programs in a DBMS package establish an interface between the database itself and the users of the database.. (These users may be applications programmers, managers and others with information needs, and various OS programs.)A DBMS can organize, process, and present selected data elements form the database. This capability enables decision makers to search, probe, and query database contents in order to extract answers to nonrecurring and unplanned questions that aren’t available in regular reports. These questions might initially be vague and/or poorly defined ,but people can “browse” through the database until they have the needed information. In short, the DBMS will “manage” the stored data items and assemble the needed items from the common database in response to the queries of those who aren’t programmers.A database management system (DBMS) is composed of three major parts:(1)a storage subsystem that stores and retrieves data in files;(2) a modeling and manipulation subsystem that provides the means with which to organize the data and to add , delete, maintain, and update the data;(3)and an interface between the DBMS and its users. Several major trends are emerging that enhance the value and usefulness of database management systems;Managers: who require more up-to-data information to make effective decisionCustomers: who demand increasingly sophisticated information services and more current information about the status of their orders, invoices, and accounts.Users: who find that they can develop custom applications with database systems in a fraction of the time it takes to use traditional programming languages.Organizations : that discover information has a strategic value; they utilize their database systems to gain an edge over their competitors.The Database ModelA data model describes a way to structure and manipulate the data in a database. The structural part of the model specifies how data should be represented(such as tree, tables, and so on ).The manipulative part of the model specifies the operation with which to add, delete, display, maintain, print, search, select, sort and update the data.Hierarchical ModelThe first database management systems used a hierarchical model-that is-they arranged records into a tree structure. Some records are root records and all others have unique parent records. The structure of the tree is designed to reflect the order in which the data will be used that is ,the record at the root of a tree will be accessed first, then records one level below the root ,and so on.The hierarchical model was developed because hierarchical relationships are commonly found in business applications. As you have known, an organization char often describes a hierarchical relationship: top management is at the highest level, middle management at lower levels, and operational employees at the lowest levels. Note that within a strict hierarchy, each level of management may have many employees or levels of employees beneath it, but each employee has only one manager. Hierarchical data are characterized by this one-to-many relationship among data.In the hierarchical approach, each relationship must be explicitly defined when the database is created. Each record in a hierarchical database can contain only one key field and only one relationship is allowed between any two fields. This can create a problem because data do not always conform to such a strict hierarchy.Relational ModelA major breakthrough in database research occurred in 1970 when E. F. Codd proposed a fundamentally different approach to database management called relational model ,which uses a table as its data structure.The relational database is the most widely used database structure. Data is organized into related tables. Each table is made up of rows called and columns called fields. Each record contains fields of data about some specific item. For example, in a table containing information on employees, a recordwould contain fields of data such as a person’s last name ,first name ,and street address.Structured query language(SQL)is a query language for manipulating data in a relational database .It is nonprocedural or declarative, in which the user need only specify an English-like description that specifies the operation and the described record or combination of records. A query optimizer translates the description into a procedure to perform the database manipulation.Network ModelThe network model creates relationships among data through a linked-list structure in which subordinate records can be linked to more than one parent record. This approach combines records with links, which are called pointers. The pointers are addresses that indicate the location of a record. With the network approach, a subordinate record can be linked to a key record and at the same time itself be a key record linked to other sets of subordinate records. The network mode historically has had a performance advantage over other database models. Today , such performance characteristics are only important in high-volume ,high-speed transaction processing such as automatic teller machine networks or airline reservation system.Both hierarchical and network databases are application specific. If a new application is developed ,maintaining the consistency of databases in different applications can be very difficult. For example, suppose a new pension application is developed .The data are the same, but a new database must be created.Object ModelThe newest approach to database management uses an object model , in which records are represented by entities called objects that can both store data and provide methods or procedures to perform specific tasks.The query language used for the object model is the same object-oriented programming language used to develop the database application .This can create problems because there is no simple , uniform query language such as SQL . The object model is relatively new, and only a few examples of object-oriented database exist. It has attracted attention because developers who choose an object-oriented programming language want a database based on an object-oriented model. Distributed DatabaseSimilarly , a distributed database is one in which different parts of the database reside on physically separated computers . One goal of distributed databases is the access of information without regard to where the data might be stored. Keeping in mind that once the users and their data are separated , the communication and networking concepts come into play .Distributed databases require software that resides partially in the larger computer. This software bridges the gap between personal and large computers and resolves the problems of incompatible dataformats. Ideally, it would make the mainframe databases appear to be large libraries of information, with most of the processing accomplished on the personal computer.A drawback to some distributed systems is that they are often based on what is called a mainframe-entire model , in which the larger host computer is seen as the master and the terminal or personal computer is seen as a slave. There are some advantages to this approach . With databases under centralized control , many of the problems of data integrity that we mentioned earlier are solved . But today’s personal computers, departmental computers, and distributed processing require computers and their applications to communicate with each other on a more equal or peer-to-peer basis. In a database, the client/server model provides the framework for distributing databases.One way to take advantage of many connected computers running database applications is to distribute the application into cooperating parts that are independent of one anther. A client is an end user or computer program that requests resources across a network. A server is a computer running software that fulfills those requests across a network . When the resources are data in a database ,the client/server model provides the framework for distributing database.A file serve is software that provides access to files across a network. A dedicated file server is a single computer dedicated to being a file server. This is useful ,for example ,if the files are large and require fast access .In such cases, a minicomputer or mainframe would be used as a file server. A distributed file server spreads the files around on individual computers instead of placing them on one dedicated computer.Advantages of the latter server include the ability to store and retrieve files on other computers and the elimination of duplicate files on each computer. A major disadvantage , however, is that individual read/write requests are being moved across the network and problems can arise when updating files. Suppose a user requests a record from a file and changes it while another user requests the same record and changes it too. The solution to this problems called record locking, which means that the first request makes others requests wait until the first request is satisfied . Other users may be able to read the record, but they will not be able to change it .A database server is software that services requests to a database across a network. For example, suppose a user types in a query for data on his or her personal computer . If the application is designed with the client/server model in mind ,the query language part on the personal computer simple sends the query across the network to the database server and requests to be notified when the data are found.Examples of distributed database systems can be found in the engineering world. Sun’s Network Filing System(NFS),for example, is used in computer-aided engineering applications to distribute data among the hard disks in a network of Sun workstation.Distributing databases is an evolutionary step because it is logical that data should exist at thelocation where they are being used . Departmental computers within a large corporation ,for example, should have data reside locally , yet those data should be accessible by authorized corporate management when they want to consolidate departmental data . DBMS software will protect the security and integrity of the database , and the distributed database will appear to its users as no different from the non-distributed database .In this information age, the data server has become the heart of a company. This one piece of software controls the rhythm of most organizations and is used to pump information lifeblood through the arteries of the network. Because of the critical nature of this application, the data server is also the one of the most popular targets for hackers. If a hacker owns this application, he can cause the company's "heart" to suffer a fatal arrest.Ironically, although most users are now aware of hackers, they still do not realize how susceptible their database servers are to hack attacks. Thus, this article presents a description of the primary methods of attacking database servers (also known as SQL servers) and shows you how to protect yourself from these attacks.You should note this information is not new. Many technical white papers go into great detail about how to perform SQL attacks, and numerous vulnerabilities have been posted to security lists that describe exactly how certain database applications can be exploited. This article was written for the curious non-SQL experts who do not care to know the details, and as a review to those who do use SQL regularly.What Is a SQL Server?A database application is a program that provides clients with access to data. There are many variations of this type of application, ranging from the expensive enterprise-level Microsoft SQL Server to the free and open source mySQL. Regardless of the flavor, most database server applications have several things in common.First, database applications use the same general programming language known as SQL, or Structured Query Language. This language, also known as a fourth-level language due to its simplistic syntax, is at the core of how a client communicates its requests to the server. Using SQL in its simplest form, a programmer can select, add, update, and delete information in a database. However, SQL can also be used to create and design entire databases, perform various functions on the returned information, and even execute other programs.To illustrate how SQL can be used, the following is an example of a simple standard SQL query and a more powerful SQL query:Simple: "Select * from dbFurniture.tblChair"This returns all information in the table tblChair from the database dbFurniture.Complex: "EXEC master..xp_cmdshell 'dir c:\'"This short SQL command returns to the client the list of files and folders under the c:\ directory of the SQL server. Note that this example uses an extended stored procedure that is exclusive to MS SQL Server.The second function that database server applications share is that they all require some form of authenticated connection between client and host. Although the SQL language is fairly easy to use, at least in its basic form, any client that wants to perform queries must first provide some form of credentials that will authorize the client; the client also must define the format of the request and response.This connection is defined by several attributes, depending on the relative location of the client and what operating systems are in use. We could spend a whole article discussing various technologies such as DSN connections, DSN-less connections, RDO, ADO, and more, but these subjects are outside the scope of this article. If you want to learn more about them, a little Google'ing will provide you with more than enough information. However, the following is a list of the more common items included in a connection request.Database sourceRequest typeDatabaseUser IDPasswordBefore any connection can be made, the client must define what type of database server it is connecting to. This is handled by a software component that provides the client with the instructions needed to create the request in the correct format. In addition to the type of database, the request type can be used to further define how the client's request will be handled by the server. Next comes the database name and finally the authentication information.All the connection information is important, but by far the weakest link is the authentication information—or lack thereof. In a properly managed server, each database has its own users with specifically designated permissions that control what type of activity they can perform. For example, a user account would be set up as read only for applications that need to only access information. Another account should be used for inserts or updates, and maybe even a third account would be used for deletes. This type of account control ensures that any compromised account is limited in functionality. Unfortunately, many database programs are set up with null or easy passwords, which leads to successful hack attacks.译文数据库管理系统介绍数据库(database,有时拼作data base)又称为电子数据库,是专门组织起来的一组数据或信息,其目的是为了便于计算机快速查询及检索。

什么是SQL语言它在数据库管理中的作用是什么

什么是SQL语言它在数据库管理中的作用是什么

什么是SQL语言它在数据库管理中的作用是什么SQL语言全称为Structured Query Language(结构化查询语言),是一种用于管理和操作关系型数据库的编程语言。

它是一种标准化的数据库语言,被广泛应用于各类数据库系统中。

本文将从SQL语言的定义、基本语法、数据库管理以及作用等方面进行阐述。

一、SQL语言的定义及基本语法SQL语言是一种用于管理和操作关系型数据库的编程语言。

它最早由IBM公司研发,后经过多年的发展和标准化,目前已成为全球各类关系型数据库系统的标准语言。

SQL语言的基本语法包括几个核心部分:数据定义语言(DDL)、数据操纵语言(DML)、数据查询语言(DQL)、数据控制语言(DCL)以及事务控制语言(TCL)。

其中,DDL用于创建和修改数据库对象(表、索引、视图等),DML用于插入、更新和删除数据,DQL用于查询数据,DCL用于控制数据库的访问权限,而TCL用于控制事务的提交和回滚。

二、SQL语言在数据库管理中的作用SQL语言在数据库管理中起着重要的作用,主要体现在以下几个方面:1. 数据定义和修改:SQL语言通过DDL语句来定义数据库的结构和模式,包括创建、修改和删除表、索引、视图以及其他数据库对象。

通过DDL语句,可以精确地定义表的列、数据类型、约束等,实现数据的结构化存储和管理。

2. 数据操作和查询:SQL语言通过DML和DQL语句来操作和查询数据库中的数据。

通过DML语句,可以向数据库表中插入新的数据、修改现有数据以及删除数据;而通过DQL语句,可以从数据库表中查询和检索数据,支持各种复杂的查询操作,如条件查询、聚合查询、排序等。

3. 数据控制和权限管理:SQL语言通过DCL语句来控制数据库的访问权限和安全性。

通过DCL语句,可以授予用户不同的权限,限制数据的访问和操作,保护数据库的安全性。

同时,SQL语言还支持视图(View)的概念,可以通过视图实现数据的虚拟化和权限控制。

外文翻译---数据仓库技术

外文翻译---数据仓库技术

附录1 外文原文Data warehouse techniqueThe data warehouse says allThe data warehouse is an environment, not a product. It provides the decision that customer used for current history data supports, these data is very difficult in traditional operation type database or can't get, say more tangibly, the data warehouse is a kind of system construction. Data warehouse than it customer relation the management is a concept that is been familiar with by person, it is 1991 the United States an information engineering learns what house W.H. Inmon Doctor put forward, its definition is" the data warehouse is a support decision the process faces to the topic of, gather of, at any time but change of, the last long data gathers".The technique system construction of the data warehouse The data of obtains mold piece: Used for obtaining the data from the source document with the source database, combine the proceeding sweep, delivering, adding it to data warehouse database inside.· Data management mold piece: Used for the movement of the management data warehouse.· Delivers mold piece: Used for the other warehouse in direction with assign the data warehouse data in the exterior system.· The data is in the center a mold piece: The end customer in direction tool that used for the method provides the interview data warehouse database.· Data interview mold piece: Used for providing the interview for the end customer of the business enterprise with the tool of the analysis data warehouse data.· Design mold piece: Used for the design data warehouse database.· Information catalogue mold piece: Used for governor to provide with the customer relevant saving contents in data warehouse data in the database with meaning information.How to establish the data warehouseCurrent, the internal calculator in business enterprise system is mutually independent, the data rule( legitimacy) demand of the system that have is affirmedfrom the other system, various data lacks to gather sex, conduct and actions trend, the data warehouse technique is an one of the most emollient way to makes these data gathered get ups, the data warehouse establishes can at logical realize various system interaction operation, this lay the foundation for the modern college in developments, also leads for the college layer science decision offering guarantees powerfully. The process that establish in the data warehouse needs below step: 1. Establish the data model to the end business need. The design of the data model not only consider only to the first topic, but also looks after both sides the need of the other management in college decision topic to searches the need of the topic with every kind of data, statement.2. The certain topic proceeding data sets up the mold. According to the decision need certain topic, choice data source, proceed logic construction design.3. The database of the design data warehouse. Put great emphasis on the saving construction in physics that apply in the topic development data warehouse inside data.4. Definition data source. According to the topic data model, choose different operation type database as the data source.5. Establish the model for a data. The model made sure into the data scope of the data warehouse, and with provision of relevant data. Complete a data, can let customer known, the data warehouse inside has actually what data, the data gathers the level of structure with how detailed degree is, can provide what information, how these information are carried calculates with organizes etc..6. Take( Extract), convert( Transmit), add from the operation type database inside take out the data that carry( Load) the database inside arrive the data warehouse.7. Choice data interview analysis tool, the customer will use the saving information within these toolses interview data warehouse, realizing decision support need.The data scoops out the techniqueAlong with the database technical develop continuously and extensive application in each profession in system in management in database, the backlog enlarges in the nasty play in amount of data in the database, but among them can use directly however opposite less in amount of information.People have been hoping can to conceal in the superficial information in these data, proceed many level of structures analyze, for the purpose of better land utilization acquire the benefit to operate in the business with these data, increase the information of the social competition ability.Current every kind of database management system although can realizes efficiently the data record into and search, statistics to wait the function, can't discover relation existed in the data with regulation, resulted in like this and then a kind of data Bang and knowledge needy keep both of phenomenon. According to the inquisition, the data collections increase with saving with every year 130% speed, but in the data only have 2% data to is analyzed availably. This exploitation that scoop out provided the vast space for the data .To the 2004, apply to attain USD 1,000,000,000 in the data of the electronic commerce market of scooping out the tool.附录2 外文资料译文数据仓库技术数据仓库概述数据仓库是一个环境,而不是一件产品。

sql名词解释

sql名词解释

SQL(Structured Query Language)是一种用于管理和操作关系数据库系统的标准语言。

它是一种用于查询、插入、更新和删除数据库中的数据的高级语言,也是用于定义数据库的架构、数据类型和关系结构的标准语言。

SQL是用于与关系型数据库管理系统(RDBMS)进行交互的标准语言。

在SQL中,数据以表格的形式存储,每个表格由一系列行组成,每行包含一个记录的数据。

表格中的列定义了记录的数据类型和列名,而表格之间的关系则通过连接不同表格的列来实现。

SQL的主要功能包括:1. 数据查询:使用SELECT语句从数据库中检索数据。

可以使用WHERE子句筛选数据,使用ORDER BY子句对结果进行排序,使用LIMIT子句限制返回的行数。

2. 数据插入:使用INSERT语句将新的数据记录插入到数据库中。

3. 数据更新:使用UPDATE和DELETE语句修改和删除现有数据记录。

4. 数据定义:使用CREATE、ALTER和DROP语句定义和修改数据库的架构、数据类型和关系结构。

5. 数据控制:使用GRANT和REVOKE语句控制对数据库的访问权限。

SQL语言具有语法简单、易学易用的特点,是数据库管理员和开发人员常用的工具之一。

它广泛应用于各种企业和机构,用于管理大量的数据并支持关键业务应用程序的运行。

在使用SQL时,需要与数据库管理系统(DBMS)进行交互。

DBMS是一种软件系统,用于存储、检索、管理和保护数据。

它提供了SQL接口,使开发人员和数据库管理员能够与数据库进行交互,执行各种操作和任务。

总结来说,SQL是一种用于管理和操作关系数据库的标准语言,具有数据查询、插入、更新、定义和控制等主要功能。

它与数据库管理系统(DBMS)进行交互,用于管理大量的数据并支持关键业务应用程序的运行。

SQL Server数据库管理外文翻译文献

SQL Server数据库管理外文翻译文献

SQL Server数据库管理外文翻译文献本文翻译了一篇关于SQL Server数据库管理的外文文献。

摘要该文献介绍了SQL Server数据库管理的基本原则和策略。

作者指出,重要的决策应该基于独立思考,避免过多依赖外部帮助。

对于非可确认的内容,不应进行引用。

文献还强调了以简单策略为主、避免法律复杂性的重要性。

内容概述本文详细介绍了SQL Server数据库管理的基本原则和策略。

其中包括:1. 独立决策:在数据库管理中,决策应该基于独立思考。

不过多依赖用户的帮助或指示,而是依靠数据库管理员的专业知识和经验进行决策。

独立决策:在数据库管理中,决策应该基于独立思考。

不过多依赖用户的帮助或指示,而是依靠数据库管理员的专业知识和经验进行决策。

2. 简单策略:为了避免法律复杂性和错误的决策,应采用简单策略。

这意味着避免引用无法确认的内容,只使用可靠和可验证的信息。

简单策略:为了避免法律复杂性和错误的决策,应采用简单策略。

这意味着避免引用无法确认的内容,只使用可靠和可验证的信息。

3. 数据库管理准则:文献提出了一些SQL Server数据库管理的准则,包括:规划和设计数据库结构、有效的数据备份和恢复策略、用户权限管理、性能优化等。

数据库管理准则:文献提出了一些SQL Server数据库管理的准则,包括:规划和设计数据库结构、有效的数据备份和恢复策略、用户权限管理、性能优化等。

结论文献通过介绍SQL Server数据库管理的基本原则和策略,强调了独立决策和简单策略的重要性。

数据库管理员应该依靠自己的知识和经验,避免过度依赖外部帮助,并采取简单策略来管理数据库。

此外,遵循数据库管理准则也是确保数据库安全和性能的重要手段。

以上是对于《SQL Server数据库管理外文翻译文献》的详细内容概述和总结。

如果需要更多详细信息,请阅读原文献。

SQL_Server简介外文翻译

SQL_Server简介外文翻译

外文原文Introduction to SQL ServerBy SamuelRelational databases have been around for 30 years, but they were not the original kind of database, nor are they the newest kind of database. XML and object-oriented data structures have evolved in recent 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 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?F irst, SQL is the premier tool for viewing information from a relational database. It doesn’t 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 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, such 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 haiku 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 can have a complete database and all its data expressed in programming code. This greatly enhances a database programmer’s 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 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 andfundamentals easily. If you want to explore a RDBMS 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). The 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.) 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 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 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 write the commands. The languages are standardized under the name SQL(Structured Query Language). The following definition for SQL is from Books On line“A language used to insert, retrieve, modify, and delete data in a relational database.SQL also contains statements for defining and administering the objects 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.”Representation 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 the records in a table. Primary Keys don’t 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 should 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 relationship. The field in the other table on the other end of that relationship is called the foreign key. The term simply 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 Artist ID field is the primary key in the Artists table. Therefore, the Artist ID 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 table 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 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 doesn’t have direct interaction with Users.A DBMS should have the following functionality –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 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 runs 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.T he most basic misunderstanding of many junior developers is considering SQL Enterprise Manager as the SQL server. SQL Enterprise Manager is a tool used to access theSQL 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 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, Constraints etc using Enterprise manger easily. I have seen many of developers don’t 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 also 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 Windows 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 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 Whiz 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 and 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 point says that the client should retrieve only the data that it needs. This is because transferring data from Server to Client utilizes server’s resource and also increases network traffic.DDL (Data Definition Language)What is data type? –Classification of data into similar groups. Names, Money,Date, Time, 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 includes 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 exhibit 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 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 SQLServer.4) Migrating data from SQL server to other datasources.Since 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 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 destination 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 database 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. Theoptions include what 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 简介Samuel著关系数据库已经存在了30年,但他们不是原种的数据库,他们也不是最新的数据库。

sql数据库名词解释

sql数据库名词解释

sql数据库名词解释SQL(Structured Query Language)是一种用于管理关系型数据库的编程语言。

它提供了一组用于创建、修改和查询数据库的命令和语法。

SQL数据库名词解释如下:1. 数据库(Database):数据库是一个组织和存储数据的容器。

它可以包含多个表,每个表都包含一组相关的数据。

2. 表(Table):表是数据库中的一个对象,它由行和列组成。

每行代表表中的一个记录,每列代表记录中的一个属性或字段。

3. 列(Column):列是表中的一个字段或属性,它定义了每个记录所拥有的数据类型。

4. 行(Row):行是表中的一个记录,它包含了一组相关的数据。

5. 主键(Primary Key):主键是表中唯一标识每个记录的字段。

它的值必须是唯一且不为空。

6. 外键(Foreign Key):外键是表中的一个字段,它用于建立两个表之间的关联。

外键的值必须与另一个表中的主键值相匹配。

7. 索引(Index):索引是用于加快数据库查询速度的数据结构。

它创建一个特定字段的副本,并按照指定的顺序进行排序和搜索。

8. 视图(View):视图是基于一个或多个表的查询结果构建的虚拟表。

它可以简化复杂的查询操作,并提供更高级的数据访问控制。

9. 触发器(Trigger):触发器是与数据库中的表相关联的特殊存储过程。

当特定的数据库操作发生时,触发器可以自动执行一系列定义好的操作。

10. 存储过程(Stored Procedure):存储过程是一组预定义的SQL语句集合,被保存在数据库中并可以被反复调用。

它可以接收参数并返回结果。

以上是SQL数据库中一些常见的名词解释。

熟悉这些名词对于理解和操作SQL 数据库非常重要。

常用SQL数据库知识点

常用SQL数据库知识点

常用SQL数据库知识点
1、SQL数据库概述:
SQL数据库(Structured Query Language)是一种关系型数据库,
它使用结构化查询语言(SQL)来建立、维护和检索数据。

SQL数据库是
指用于存储数据的特定类型的数据库,一般用于存储大量信息,可以索引,可以检索,并且具有结构化查询语言(SQL)支持。

SQL数据库支持使用SQL 来查询、更新和管理数据库,以提高数据利用。

2、SQL语句:
SQL语句是Structured Query Language(SQL)的核心,它可以用来
与数据库进行交互。

SQL语句是一组指令,用来查询,更新,删除,插入
和创建数据库中的数据。

常用的SQL语句包括SELECT,INSERT,UPDATE,DELETE,CREATE,ALTER和DROP等。

3、索引:
索引是一种用于提高SQL查询性能的技术。

索引可以加快查询速度,
因为它提供了一个快速查找表中特定记录的方式。

SQL数据库支持多种不
同类型的索引,包括索引,唯一索引,全文索引等。

4、DML:
DML(Data Manipulation Language)是一种用于在SQL数据库中查
询和更新数据的语言。

它可以用于检索,插入,更新和删除数据库中的记录。

常用的DML语句包括SELECT,INSERT,UPDATE和DELETE等语句。

5、DDL:
DDL(Data Definition Language)是一种用于定义数据库结构的语言。

它可以用来创建,修改和删除数据库对象,如表、视图、存储过程、函数等。

sql translators使用

sql translators使用

SQL Translators使用1. 什么是SQL Translators?SQL Translators是一种工具或软件,用于将一种数据库管理系统(DBMS)的SQL语句转换为另一种DBMS所能理解和执行的SQL语句。

它可以帮助开发人员在不同的数据库平台之间迁移数据或应用程序,而无需手动重写和调整大量的SQL代码。

2. SQL Translators的作用SQL Translators主要有以下几个作用:2.1 数据库迁移当需要将一个应用程序从一个数据库平台迁移到另一个数据库平台时,通常会涉及到大量的SQL代码修改。

使用SQL Translators可以自动将原始数据库平台上的SQL语句转换为目标数据库平台所支持的语法,从而简化了迁移过程。

2.2 跨数据库查询在某些情况下,我们可能需要在多个不同的数据库平台上执行跨数据库查询。

使用SQL Translators可以使我们能够编写一次查询语句,并自动将其转换为适用于各个目标数据库平台的语法。

2.3 多数据库支持对于使用多个不同类型的数据库管理系统(如MySQL、Oracle、Microsoft SQL Server等)的应用程序来说,维护和管理多个版本的SQL代码可能非常困难。

通过使用SQL Translators,我们可以使用一种通用的SQL语法,并通过转换器将其转换为适用于不同数据库平台的语法。

3. SQL Translators的工作原理SQL Translators的工作原理可以分为以下几个步骤:3.1 解析SQL语句首先,SQL Translators会对输入的SQL语句进行解析。

它会识别出其中的关键字、表名、列名、函数等元素,并构建一个抽象语法树(Abstract Syntax Tree,AST)。

3.2 进行语法转换接下来,SQL Translators会根据目标数据库平台的特定语法规则,对AST进行相应的转换。

它会将原始数据库平台上不支持或不兼容的语法结构替换为目标数据库平台所支持的等效结构。

sql数据库详解

sql数据库详解

sql数据库详解
SQL(Structured Query Language)是一种用于管理关系型数据库的语言。

它提供了一种用于定义数据库结构、操作数据以及查询数据的标准化语法和语义。

SQL数据库是一种基于关系模型的数据库,数据以表格的形式存储,并且通过键值关联来建立表之间的关系。

SQL数据库具有以下特点:1. 数据结构化:SQL数据库使用表格的形式组织数据,每个表格都有固定的列和行。

这种结构化的方式使得数据更易于管理和查询。

2. 数据关系性:SQL数据库使用键值关联来建立表之间的关系。

通过定义主键和外键,可以实现表之间的关联,从而实现数据的一致性和完整性。

3. 数据查询:SQL提供了丰富的查询语法,可以通过简单的语句来实现复杂的数据查询。

通过使用SELECT语句,可以从数据库中检索数据,并根据条件进行筛选和排序。

4. 数据操作:SQL提供了一组用于操作数据的语句,包括插入、更新和删除数据。

通过使用INSERT、UPDATE和DELETE语句,可以对数据库中的数据进行增删改操作。

5. 数据安全性:SQL数据库提供了一系列的安全性措施,包括用户认证、访问控制和数据加密等。

这些措施可以保护数据库中的数据
免受未经授权的访问和恶意攻击。

总结来说,SQL数据库是一种基于关系模型的数据库,通过使用SQL语言可以对数据进行结构化存储、关联查询和操作,并提供了一系列的安全性措施来保护数据的安全。

外文翻译译文-SQLite的最佳应用领域

外文翻译译文-SQLite的最佳应用领域

毕业设计(论文)——外文翻译(译文)SQLite的最佳应用领域SQLite不同于其他大部分的SQL数据库引擎,因为它的首要设计目标就是简单化:●易于管理●易于操作●易于嵌入到其他大型程序●易于维护和配置许多人喜欢SQLite,因为它占用空间小,运行速度快。

然而,这些特性只是它的部分优点,还存在着许多其他特征。

用户发现SQLite是非常稳定的。

稳定性源于它的简单。

随着数据结构的简单化,数据库出错的概率会降低。

越简单就越不容易出错。

所以,除了上述的简单、小巧和稳定性外,最重要的在于SQLite力争做到简单化。

一个数据库引擎的简易化既可能成为一种优势也可能成为它的弱点,这取决于你想要做什么。

为了实现简易化的目的,SQLite不得不放弃一些人们认为有用的其他特性,比如高并发性,严格的存取控制,丰富的内置功能,存储过程,深奥的SQL语言特性,XML和Java 扩展,万亿级别的数据测量,等等。

如果你需要这些特性,并且不介意因为数据复杂性而带来的麻烦,那么,也许SQLite不适合你。

SQLite并不打算要成为一个企业级数据库引擎,也不是设计成要与Oracle或者PostgreSQL竞争的数据库。

根据经验,在这些情况下使用SQLite比较合适:当系统管理、实现、维护的简易化比企业级数据库引擎所能提供的许多其他复杂特性更重要的时候,,更有效果。

而且事实也证明,人们在许多情况下已经清楚的认识到简单就是最好的选择。

另一种看法是:SQLite不是要取代 Oracle 公司的产品,而是用来取代 fopen( )函数功能的数据库。

SQLite最佳适用场合●应用程序文件格式SQLite作为为桌面应用程序服务的磁盘格式文件取得非常大的成功,如金融分析工具,CAD软件包,档案管理程序等等。

一般的数据库打开操作需要调用sqlite3_open()函数,并且标记一个显式本地事务的起始点(BEGIN TRANSACTION)来保证以独占的方式得到文件的内容。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Working with DatabasesThis chapter describes how to use SQL statements in embedded applications to control databases. There are three database statements that set up and open databases for access: SET DATABASE declares a database handle, associates the handle with an actual database file, and optionally assigns operational parameters for the database.SET NAMES optionally specifies the character set a client application uses for CHAR, VARCHAR, and text Blob data. The server uses this information totransli terate from a database‟s default character set to the client‟s character set on SELECT operations, and to transliterate from a client application‟s character set to the database character set on INSERT and UPDATE operations.g CONNECT opens a database, allocates system resources for it, and optionally assigns operational parameters for the database.All databases must be closed before a program ends. A database can be closed by using DISCONNECT, or by appending the RELEASE option to the final COMMIT or ROLLBACK in a program. Declaring a databaseBefore a database can be opened and used in a program, it must first be declared with SET DATABASE to:CHAPTER 3 WORKING WITH DATABASES. Establish a database handle. Associate the database handle with a database file stored on a local or remote node.A database handle is a unique, abbreviated alias for an actual database name. Database handles are used in subsequent CONNECT, COMMIT RELEASE, and ROLLBACK RELEASE statements to specify which databases they should affect. Except in dynamic SQL (DSQL) applications, database handles can also be used inside transaction blocks to qualify, or differentiate, table names when two or more open databases contain identically named tables.Each database handle must be unique among all variables used in a program. Database handles cannot duplicate host-language reserved words, and cannot be InterBase reserved words.The following statement illustrates a simple database declaration:EXEC SQLSET DATABASE DB1 = ‟employee.gdb‟;This database declaration identifies the database file, employee.gdb, as a database the program uses, and assigns the database a handle, or alias, DB1.If a program runs in a directory different from the directory that contains the database file, then the file name specification in SET DATABASE must include a full path name, too. For example, the following SET DATABASE declaration specifies the full path to employee.gdb:EXEC SQLSET DATABASE DB1 = ‟/interbase/examples/employee.gdb‟;If a program and a database file it uses reside on different hosts, then the file name specification must also include a host name. The following declaration illustrates how a Unix host name is included as part of the database file specification on a TCP/IP network:EXEC SQLSET DATABASE DB1 = ‟jupiter:/usr/interbase/examples/employee.gdb‟;On a Windows network that uses the Netbeui protocol, specify the path as follows: EXEC SQLSET DATABASE DB1 = ‟//venus/C:/Interbase/examples/employee.gdb‟; DECLARING A DATABASEEMBEDDED SQL GUIDE 37Declaring multiple databasesAn SQL program, but not a DSQL program, can access multiple databases at the same time. In multi-database programs, database handles are required. A handle is used to:1. Reference individual databases in a multi-database transaction.2. Qualify table names.3. Specify databases to open in CONNECT statements.Indicate databases to close with DISCONNECT, COMMIT RELEASE, and ROLLBACK RELEASE.DSQL programs can access only a single database at a time, so database handle use is restricted to connecting to and disconnecting from a database.In multi-database programs, each database must be declared in a separate SET DATABASE statement. For example, the following code contains two SET DATABASE statements:. . .EXEC SQLSET DATABASE DB2 = ‟employee2.gdb‟;EXEC SQLSET DATABASE DB1 = ‟employee.gdb‟;. . .4Using handles for table namesWhen the same table name occurs in more than one simultaneously accessed database, a database handle must be used to differentiate one table name from another. The database handle is used as a prefix to table names, and takes the formhandle.table.For example, in the following code, the database handles, TEST and EMP, are used to distinguish between two tables, each named EMPLOYEE:. . .EXEC SQLDECLARE IDMATCH CURSOR FORSELECT TESTNO INTO :matchid FROM TEST.EMPLOYEEWHERE TESTNO > 100;EXEC SQLDECLARE EIDMATCH CURSOR FORSELECT EMPNO INTO :empid FROM EMP.EMPLOYEEWHERE EMPNO = :matchid;. . .CHAPTER 3 WORKING WITH DATABASES38 INTERBASE 6IMPORTANTThis use of database handles applies only to embedded SQL applications. DSQL applications cannot access multiple databases simultaneously.4Using handles with operationsIn multi-database programs, database handles must be specified in CONNECT statements to identify which databases among several to open and prepare for use in subsequent transactions.Database handles can also be used with DISCONNECT, COMMIT RELEASE, and ROLLBACKRELEASE to specify a subset of open databases to close.To open and prepare a database w ith CONNECT, see “Opening a database” on page 41.To close a database with DISCONNECT, COMMIT RELEASE, or ROLLBACK RELEASE, see“Closing a database” on page 49. To learn more about using database handles in transactions, see “Accessing an open database” on p age 48.Preprocessing and run time databasesNormally, each SET DATABASE statement specifies a single database file to associate with a handle. When a program is preprocessed, gpre uses the specified file to validate the program‟s table and column referenc es. Later, when a user runs the program, the same database file is accessed. Different databases can be specified for preprocessing and run time when necessary.4Using the COMPILETIME clause A program can be designed to run against any one of several identically structured databases. In other cases, the actual database that a program will use at runtime is not available when a program is preprocessed and compiled. In such cases, SET DATABASE can include a COMPILETIME clause to specify a database for gpre to test against during preprocessing. For example, the following SET DATABASE statement declares that employee.gdb is to be used by gpre during preprocessing: EXEC SQLSET DATABASE EMP = COMPILETIME ‟employee.gdb‟;IMPORTANTThe file specification that follows the COMPILETIME keyword must always be a hard-coded, quoted string.DECLARING A DATABASEEMBEDDED SQL GUIDE 39When SET DATABASE uses the COMPILETIME clause, but no RUNTIME clause, and does not specify a different database file specification in a subsequent CONNECT statement, the same database file is used both for preprocessing and run time. To specify different preprocessing and runtime databases with SET DATABASE, use both the COMPILETIME andRUNTIME clauses.4Using the RUNTIME clauseWhen a database file is specified for use during preprocessing, SET DATABASE can specify a different database to use at run time by including the RUNTIME keyword and a runtime file specification:EXEC SQLSET DATABASE EMP = COMPILETIME ‟employee.gdb‟RUNTIME ‟employee2.gdb‟;The file specification that follows the RUNTIME keyword can be either ahard-coded, quoted string, or a host-language variable. For example, the following C code fragment prompts the user for a database name, and stores the name in a variable that is used later in SET DATABASE:. . .char db_name[125];. . .printf("Enter the desired database name, including node and path):\n");gets(db_name);EXEC SQLSET DATABASE EMP = COMPILETIME ‟employee.gdb‟ RUNTIME : db_name; . . .Note host-language variables in SET DATABASE must be preceded, as always, by a colon.Controlling SET DATABASE scopeBy default, SET DATABASE creates a handle that is global to all modules in an application.A global handle is one that may be referenced in all host-language modules comprising the program. SET DATABASE provides two optional keywords to change the scope of a declaration:g STATIC limits declaration scope to the module containing the SET DATABASE statement. No other program modules can see or use a database handle declared STATIC.CHAPTER 3 WORKING WITH DATABASES40 INTERBASE 6EXTERN notifies gpre that a SET DATABASE statement in a module duplicates a globally-declared database in another module. If the EXTERN keyword is used, then another module must contain the actual SET DATABASE statement, or an error occurs during compilation.The STATIC keyword is used in a multi-module program to restrict database handle access to the single module where it is declared. The following example illustrates the use of theSTATIC keyword:EXEC SQLSET DATABASE EMP = STATIC ‟employee.gdb‟;The EXTERN keyword is used in a multi-module program to signal that SET DATABASE in one module is not an actual declaration, but refers to a declaration made in a different module. Gpre uses this information during preprocessing. The following example illustrates the use of the EXTERN keyword:EXEC SQLSET DATABASE EMP = EXTERN ‟employee.gdb‟;If an application contains an EXTERN reference, then when it is used at run time, the actual SET DATABASE declaration must be processed first, and the database connected before other modules can access it.A single SET DATABASE statement can contain either the STATIC or EXTERN keyword, but not both. A scope declaration in SET DATABASE applies to both COMPILETIME and RUNTIME databases.Specifying a connection character setWhen a client application connects to a database, it may have its own character set requirements. The server providing database access to the client does not know about these requirements unless the client specifies them. The client application specifies its character set requirement using the SET NAMES statement before it connects to the database.SET NAMES specifies the character set the server should use when translating data from the database to the client application. Similarly, when the client sends data to the database, the server translates the data from the client‟s character set to the database‟s default character set (or the character set for an individual column if it differs from the databas e‟s default character set). For example, the following statements specify that the client is using the DOS437 character set, then connect to the database:EXEC SQLOPENING A DATABASEEMBEDDED SQL GUIDE 41SET NAMES DOS437;EXEC SQLCONNECT ‟europe.gdb‟ USER ‟JAMES‟ PASSWORD ‟U4EEAH‟;For more information about character sets, see the Data Definition Guide. For the complete syntax of SET NAMES and CONNECT, see the Language Reference. Opening a databaseAfter a database is declared, it must be attached with a CONNECT statement before it can be used. CONNECT:1. Allocates system resources for the database.2. Determines if the database file is local, residing on the same host where the application itself is running, or remote, residing on a different host.3. Opens the database and examines it to make sure it is valid.InterBase provides transparent access to all databases, whether local or remote. If the database structure is invalid, the on-disk structure (ODS) number does not correspond to the one required by InterBase, or if the database is corrupt, InterBase reports an error, and permits no further access. Optionally, CONNECT can be used to specify:4. A user name and password combination that is checked against the server‟s security database before allowing the connect to succeed. User names can be up to 31 characters.Passwords are restricted to 8 characters.5. An SQL role name that the user adopts on connection to the database, provided that the user has previously been granted membership in the role. Regardless of role memberships granted, the user belongs to no role unless specified with this ROLE clause.The client can specify at most one role per connection, and cannot switch roles except by reconnecting.6. The size of the database buffer cache to allocate to the application when the default cache size is inappropriate.Using simple CONNECT statementsIn its simplest form, CONNECT requires one or more database parameters, each specifying the name of a database to open. The name of the database can be a: Database handle declared in a previous SET DATABASE statement.CHAPTER 3 WORKING WITH DATABASES42 INTERBASE 61. Host-language variable.2. Hard-coded file name.4Using a database handleIf a program uses SET DATABASE to provide database handles, those handles should be used in subsequent CONNECT statements instead of hard-coded names. For example,. . .EXEC SQLSET DATABASE DB1 = ‟employee.gdb‟;EXEC SQLSET DATABASE DB2 = ‟employee2.gdb‟;EXEC SQLCONNECT DB1;EXEC SQLCONNECT DB2;. . .There are several advantages to using a database handle with CONNECT:1. Long file specifications can be replaced by shorter, mnemonic handles.2. Handles can be used to qualify table names in multi-database transactions. DSQL applications do not support multi-database transactions.3. Handles can be reassigned to other databases as needed.4. The number of database cache buffers can be specified as an additional CONNECT parameter.For more information about setting the number of database cache buffers, see “Setting d atabase cache buffers” on page 47. 4Using strings or host-language variables Instead of using a database handle, CONNECT can use a database name supplied at run time. The database name can be supplied as either a host-language variable or a hard-coded, quoted string.The following C code demonstrates how a program accessing only a single database might implement CONNECT using a file name solicited from a user at run time:. . .char fname[125];. . .printf(‟Enter the desired database name, including nodeand path):\n‟);OPENING A DATABASEEMBEDDED SQL GUIDE 43gets(fname);. . .EXEC SQLCONNECT :fname;. . .TipThis technique is especially useful for programs that are designed to work with many identically structured databases, one at a time, such as CAD/CAM or architectural databases.MULTIPLE DATABASE IMPLEMENTATIONTo use a database specified by the user as a host-language variable in a CONNECT statement in multi-database programs, follow these steps:1. Declare a database handle using the following SET DATABASE syntax:EXEC SQLSET DATABASE handle = COMPILETIME ‟ dbname‟;Here, handle is a hard-coded database handle supplied by the programmer, dbnameis a quoted, hard-coded database name used by gpre during preprocessing.2. Prompt the user for a database to open.3. Store the database name entered by the user in a host-language variable.4. Use the handle to open the database, associating the host-language variable with the handle using the following CONNECT syntax:EXEC SQLCONNECT : variable AS handle;The following C code illustrates these steps:. . .char fname[125];. . .EXEC SQLSET DATABASE DB1 = ‟employee.gdb‟;printf("Enter the desired database name, including nodeand path):\n");gets(fname);EXEC SQLCONNECT :fname AS DB1;. . .CHAPTER 3 WORKING WITH DATABASES44 INTERBASE 6In this example, SET DATABASE provides a hard-coded database file name for preprocessing with gpre. When a user runs the program, the database specified in the variable, fname, is used instead. 4Using a hard-coded database namesIN SINGE-DATABASE PROGRAMSIn a single-database program that omits SET DATABASE, CONNECT must contain a hard-coded, quoted file name in the following format:EXEC SQLCONNECT ‟[ host[ path]] filename‟; host is required only if a program and a dat abase file it uses reside on different nodes.Similarly, path is required only if the database file does not reside in the current working directory. For example, the following CONNECT statement contains ahard-coded file name that includes both a Unix host name and a path name:EXEC SQLCONNECT ‟valdez:usr/interbase/examples/employee.gdb‟;Note Host syntax is specific to each server platform.IMPORTANT A program that accesses multiple databases cannot use this form of CONNECT.IN MULTI-DATABASE PROGRAMSA program that accesses multiple databases must declare handles for each of them in separate SET DATABASE statements. These handles must be used in subsequent CONNECT statements to identify specific databases to open:. . .EXEC SQLSET DATABASE DB1 = ‟employee.gdb‟;EXEC SQLSET DATABASE DB2 = ‟employee2.gdb‟;EXEC SQLCONNECT DB1;EXEC SQLCONNECT DB2;. . .Later, when the program closes these databases, the database handles are no longer in use. These handles can be reassigned to other databases by hard-coding a file name in a subsequent CONNECT statement. For example,OPENING A DATABASEEMBEDDED SQL GUIDE 45. . .EXEC SQLDISCONNECT DB1, DB2;EXEC SQLCONNECT ‟project.gdb‟ AS DB1;. . .Additional CONNECT syntaxCONNECT supports several formats for opening databases to provide programming flexibility. The following table outlines each possible syntax, provides descriptions and examples, and indicates whether CONNECT can be used in programs that access single or multiple databases:For a complete discussion of CONNECT syntax and its uses, see the Language Reference.Syntax Description ExampleSingle accessMultiple accessCONNECT …dbfile‟; Opens a single, hard-coded database file, dbfile.EXEC SQLCONNECT …employee.gdb‟;Yes NoCONNECT handle; Opens the database file associated with a previously declared database handle. This is the preferred CONNECT syntax.EXEC SQLCONNECT EMP;Yes YesCONNECT …dbfile‟ AS handle;Opens a hard-coded database file, dbfile, and assigns a previously declared database handle to it.EXEC SQLCONNECT …employee.gdb‟AS EMP;Yes Yes CONNECT :varname AS handle;Opens the database file stored in the host-language variable, varname, and assigns a previously declared database handle to it.EXEC SQL CONNECT :fname AS EMP;Yes YesTABLE 3.1 CONNECT syntax summaryCHAPTER 3 WORKING WITH DATABASES46 INTERBASE 6Attaching to multiple databasesCONNECT can attach to multiple databases. To open all databases specified in previous SETDATABASE statements, use either of the following CONNECT syntax options: EXEC SQLCONNECT ALL;EXEC SQLCONNECT DEFAULT;CONNECT can also attach to a specified list of databases. Separate each database request from others with commas. For example, the following statement opens two databases specified by their handles:EXEC SQLCONNECT DB1, DB2;The next statement opens two hard-coded database files and also assigns them to previously declared handles:EXEC SQLCONNECT ‟employee.gdb‟ AS DB1, ‟employee2.gdb‟ AS DB2;Tip Opening multiple databases with a single CONNECT is most effective when a program‟s database access is simple and clear. In complex programs that open and close several databases, that substitute database names with host-language variables, or that assign multiple handles to the same database, use separate CONNECT statements to make program code easier to read, debug, and modify.Handling CONNECT errors. The WHENEVER statement should be used to trap and handle runtime errors that occur during database declaration. The following C code fragment illustrates an error-handling routine that displays error messages and ends the program in an orderly fashion:. . .EXEC SQLWHENEVER SQLERRORGOTO error_exit;. . .OPENING A DATABASEEMBEDDED SQL GUIDE 47:error_exitisc_print_sqlerr(sqlcode, status_vector);EXEC SQLDISCONNECT ALL;exit(1);. . .For a complete discussion of SQL error handling, see Chapter 12, “Error Handling and Recovery.”数据库的工作这章描述怎样使用在嵌入式应用过程中的SQL语句控制数据库。

相关文档
最新文档