1 / 21

Enterprise Database Systems Introduction to SQL Server

Enterprise Database Systems Introduction to SQL Server. Technological Educational Institution of Larissa in collaboration with Staffordshire University Larissa 200 7. Dr. Georgia Garani garani@teilar.gr Dr. Theodoros Mitakos teo_ms@yahoo.com. SQL.

mleroy
Download Presentation

Enterprise Database Systems Introduction to 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. Enterprise Database SystemsIntroduction to SQL Server Technological Educational Institution of Larissa in collaboration with Staffordshire University Larissa 2007 Dr. Georgia Garani garani@teilar.gr Dr. Theodoros Mitakosteo_ms@yahoo.com

  2. SQL • SQL, pronounced ‘Sequel’ or simply S-Q-L, is a computer programming language that was developed especially for querying relational databases using a nonprocedural approach. • The term nonprocedural means that you can extract information by simply telling the system what information is needed without telling it how to perform the data retrieval. • Transact-SQL or T-SQL is Microsoft's implementation of the SQL language.

  3. Procedural and Nonprocedural

  4. DATA • Two types of data are stored within a database. • User data: Data that must be stored by an organization. • System data: Data the database needs to manage user data to manage itself. This is also termed metadata, or the data about data.

  5. DBMS Services • Data definition for defining and storing all of the objects that comprise a database such as tables and indexes • Data maintenance • Data manipulation • Data display • Data integrity • Data security Database backup and recovery

  6. SQL Server Versions

  7. SQL Server Versions Contd.

  8. SQL Server Features

  9. SQL Server Features Cont.

  10. SQL Query Analyzer GUI can be used to: • Create databases. • Develop, test, and debug stored procedures. • Run SQL scripts – these are miniature programs that contain either DDL or DML commands or a combination of these commands. An example would be a script to create a database, and then populate the tables in the database with data. • Optimize system performance. • Analyze query plans – these are the plans that the DBMS generates for processing a query. • Maintain and manage statistics concerning database performance. • Generate tune table indexes – the indexes are supposed to improve system performance for data retrieval.

  11. SQL Query Analyzer Contd.

  12. SQL Query Analyzer Contd.

  13. SQL Query Analyzer Contd.

  14. SQL Query Analyzer Contd.

  15. Creating a Database • When SQL Server is initially installed, five system databases are generated. These are named: (1) master, (2) model, (3) msdb, (4) distribution, and (5) tempdb. • When you create a new database in SQL Server, the DBMS uses the model database as a template to create a new database. • The command to create a user database is : CREATE DATABASE <database_name> Note: You must have prior authorization from your system administrator to execute this command.

  16. Using a Database • After you have CREATED your database(s) you must use the USE command to select a database for future processing. • You can type the USE command into the Editor pane and execute it also. USE Company; The command(s) completed successfully.

  17. Executing Scripts • Sometimes you need to execute a script that contains a series of SQL statements. The Editor pane can be used to create and save a script • Simply select the Editor pane to make it the active window, then use the toolbar Save option and specify the location, file name, and file format when the Save Query dialog box displays. • You should use the default filename extension of .sql when naming a script file.

  18. Executing Scripts

  19. Executing Scripts • You can also open scripts and execute them, even if they were created with another text editor, such as Microsoft Notepad or Word. • Select the Load SQL Script toolbar button and when the Open Query File dialog box displays, locate and select the name of the file to be opened.

  20. Executing Scripts

  21. T-SQL Naming Rules There are several rules for naming database objects that must be followed: • Identifiers can consist of letters, digits, or the symbols #, @, $, and _ (underscore). • Identifiers must be no more than 128 characters • The first character of an identifier must be either a letter (a-z, A-Z) or the #, @ or _ (underscore) symbol. After the first character, you may use digits, letters, or the symbols $, #, or _ (underscore). • Temporary objects are named by using the # symbol as the first character of the identifier. Avoid using this symbol as the leading character when naming permanent database objects. • The @ symbol as the first character of an identifier denotes a variable name. Avoid using this symbol as the leading character when naming other database objects. • SQL keywords such as SELECT and WHERE cannot be used as an identifier.

More Related