SQL - Handout INTRODUCTION A query language is the language through which users get information from the da tabase

. These languages are typically of a higher level than the traditional pro gramming languages. The query languages can be categorized as procedural or nonprocedural. In a procedural language, the user must "teach" the system to perfor m a sequence of operations on the database to obtain the desired result. In a no n-procedural language, the user describes the desired information without provid ing a specific procedure for obtaining this information. Systems of commercial d atabases offer a query language that incorporates elements of both approaches: p rocedural and non-procedural. Languages "pure": the relational algebra is proced ural, while the relational calculus and tuple relational calculus in a domain ar e non-procedural. These query languages are concise and formal, without "syntact ic sugar" of commercial languages, but illustrate the fundamental techniques for extracting data from the database. LANGUAGE SQL The name "SQL" stands for "Structured Query Language" - Structured Language Rese arch. This language, of great use, had its foundations in the relational model o f Codd (1970). Its first version was called SEQUEL (Structured Query Language Po rtuguês), defined by D. D. Chamberlin, among others, in 1974, the research labor atories of IBM (California). In 1975, we implemented a prototype application of this new language. Between 1976 and 1977, the sequel has been revised and expand ed, and had its name changed to "SQL" for legal reasons. This review was put in place an ambitious project called the IBM System R. New changes were introduced in SQL, thanks to the ideas presented by the various users of the environment. D ue to the success of this new way of consulting and data manipulation within a d atabase environment, the use of SQL is becoming greater. With that a lot of DBMS was having as the basic language SQL - SQL / DS and IBM's DB2, ORACLE, Oracle C orporation, Digital's RDB, SYBASE INC, Sybase, and Microsoft ® SQL Server ™ and others. The SQL has become a de facto standard in the world of environments rela tional database. Just now become law. Then in 1982, the American National Standa rds Institute (ANSI) has a standard SQL official language in relational environm ent. Unfortunately, like any standard that I value, today there are several SQL dialects, each obviously trying to be more standardized than the other. The rela tional model is basically composed of tables, each containing rows (records, tup les) and columns. The records in the table are not ordered and their location is by means of a key field, ie a field that takes the role of primary key of the t able. It is through this key that identifies one, and only one occurrence of the value contained in the field. One reason for the popularity of relational syste ms is its ease of handling and understanding. The SQL language was especially de veloped for the relational environment, and can be adapted to any non-relational environment. The original idea of SQL only provided its use interactively. After suffering a few extras, she also began to be able to be used in host languages such as COBOL , FORTRAN, "C", etc.. Currently, SQL takes a very important role in systems mana gement database, which may take many approaches, as the figure shows: • An inter active query language (query AdHoc) - Using SQL commands, users can build querie s powerful without the need of creating a program and may use Forms or assembly tools report; • Programming language to access the database - SQL commands embed ded in application programs that access data stored; • Language database adminis tration Data - 0 responsible for administering the database (DBA) can use SQL co mmands to accomplish their tasks; • Language client / server - The programs (cus tomer) of personal computers use SQL commands to communicate through a local net work, sharing the data stored in one location (server). The client / server arch itecture minimizes data traffic over the network; • Language for distributed dat abase - SQL assists in the distribution of data through multiple nodes connected to the computer system. Also assists in data communication with other systems;€ • Way to access other databases on different machines - SQL helps to convert bet

ween different database products placed on different machines (from micro to mai nframe). Why be a language of many applications, SQL can handle objects of diffe rent classes among the functions of a DBMS: • Data Definition (DDL) - allows the user to define the structure and organizati on of stored data, and the relationships that exist between them; • Data manipul ation (DML) - allows the user or an application program, inclusion, removal, sel ecting or updating data previously stored in the bank; • Access Control - protec ts data from unauthorized manipulations; • Data Sharing - coordinates data shari ng by concurrent users, without interfering in the action of each; • Data Integr ity - assists in the process of definition of data integrity, protecting against corruption, inconsistencies and failures of the computing system . Advantages and Disadvantages of SQL With the use and standardization of SQL, some advantages are straightforward: • Independence Manufacturer - SQL is offered in almost all DBMS's, and those who d o not yet have are flocking to it. With that I can change DBMS without worrying about the new that will come; • Portability between computers - SQL can be used from a personal computer via a workstation to a mainframe computer; • Reduced co sts Training - Based in the previous section, applications can move from one env ironment to another without requiring retraining of staff development • high-lev el structured English - SQL is formed by a set of simple sentences in English, o ffering a quick and easy to understand; • Interactive Query - SQL provides quick access to data, providing answers to the user, the complex issues in minutes or seconds; • Multiple views of data - SQL allows the creator of the database take different views of data to different users; • Definition of dynamic data - Through SQL, o ne can alter, expand or add dynamically the data structures stored with maximum flexibility; Despite all these advantages, some criticisms are addressed to the SQL: • Standardization leads to a natural, inhibition of creativity, because anyone w ho develops applications are caught in standard solutions and can not undergo im provements or changes; Even facing some problems and criticisms, the SQL language is here to stay, help ing quite deeply the lives of users and analysts at work to manipulate the data stored in a relational database. And it is about the aid that we treat, showing features of SQL commands and, through practical examples. We will not show all t he commands, especially those developed for use in a host language (cursor) will present the commands to create, update, change, exploration and removal of tabl es within a relational environment typical. Tables for the data model; VISION GRAPHICS OF REQUEST