1 / 14

SQL/Server

SQL/Server. Stephen Cunningham Thema Davis. Problem Domain. Designed for retrieval and management of data Defines the structures and operations of a data model of the database Also used for data manipulation, data access, security and many other things. Historical Context.

gauri
Download Presentation

SQL/Server

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SQL/Server Stephen Cunningham Thema Davis

  2. Problem Domain Designed for retrieval and management of data Defines the structures and operations of a data model of the database Also used for data manipulation, data access, security and many other things

  3. Historical Context First version developed IBM by Donald D. Chamberlin and Raymod F. Boyce in the early 1970’s It was called SEQUEL Standardized in 1986 by the American National Standards Institute (ANSI) Also by the International Organization of Standardization (ISO)

  4. Evolution of the Language Expansions and revisions – 1989 & 1992 1999 - Regular expression matching, recursive queries, triggers, support for procedural and control-of-flow statements, and some object-oriented features. 2003 - Introduced XML-related features, window functions, standardized sequences, and columns with auto-generated values (including identity-columns).

  5. Language Concepts Stored Procedures Selecting a Query Insert Delete Update

  6. Stored Procedures /* available online in file 'sample6' */ #include <stdio.h> #include <string.h> typedef char asciz; EXEC SQL BEGIN DECLARE SECTION; /* Define type for null-terminated strings. */ EXEC SQL TYPE asciz IS STRING(20); asciz username[20]; asciz password[20]; int dept_no; /* which department to query */ char emp_name[10][21]; char job[10][21]; EXEC SQL VAR emp_name is STRING (21); EXEC SQL VAR job is STRING (21); float salary[10]; int done_flag; int array_size; int num_ret; /* number of rows returned */ int SQLCODE; EXEC SQL END DECLARE SECTION; EXEC SQL INCLUDE sqlca; Reference: http://99-bottles-of-beer.net/language-sql-609.html

  7. Selecting A Query SELECT * FROM books WHERE price > 100.00 ORDER BY title; A select query that returns a list of expensive books.

  8. Insert INSERT INTO my_table (field1, field2, field3) VALUES ('test', 'N', NULL); Insert is used to add rows (formally tuples) to an existed table

  9. Delete DELETE FROM my_table WHERE field2 = 'N'; Delete removes zero or more existing rows from a table

  10. Update UPDATE T1 SET C1 = 2 WHERE C2 in ( SELECT C3 FROM T2 WHERE C4 = 0) Set the value of column C1 in table T1 to 2, only if the value of column C2 is found in the sub list of values in column C3 in table T2 having the column C4 equal to 0.

  11. Comparison to Java Java has classpaths, working directories, environment variables and command-line parameters Slower and less flexible

  12. Comparison to PL/SQL PL/SQL supports variables, conditions, arrays and exceptions Makes it easy to use loops Has features for object oriented programming

  13. Sources   http://www.paladn.com/sql-server-programming-environment.htm http://www.jcc.com/sql.htm http://en.wikipedia.org/wiki/Structured_Query_Language

  14. The End

More Related