Instructor InputsSession 3..Session OverviewThis session includes the following topics: Create potx

18 227 0
Instructor InputsSession 3..Session OverviewThis session includes the following topics: Create potx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Instructor Inputs Session 3 ¤NIIT Instructor Inputs 3.3 This session includes the following topics:  Create an XML document  Storing XML data in XML columns  Using XQuery  Best practices  Tips and Tricks  FAQs Slide 1 Installing Windows XP Professional Using Attended Installation Slide 1 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Collaborate Session 3 Objectives In this session, you will learn about: Creating an XML document Storing XML data in XML columns Using XQuery Best Practices while using the DML commands and creating indexes in SQL Server 2005 Tips and Tricks that will help you effectively use DML commands and use indexes in SQL Server 2005 FAQs related to DML commands and indexes in SQL Server 2005 Session Overview 3.4 Instructor Inputs ¤NIIT Slide 2 Installing Windows XP Professional Using Attended Installation Slide 2 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Colla borate Session 3 Knowledge Byte XML is a markup language that is used to describe the structure of data in a standard hierarchical manner. An XML document is composed of a number of components that can be used to represent information in a hierarchical order. These components are: Processing Instruction Tags Elements Content Attributes Comments Document Type Definition (DTD) or XML Schemas can be used to define the structure of an XML document. Slide 3 Installing Windows XP Professional Using Attended Installation Slide 3 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Colla borate Session 3 Knowledge Byte (Contd.) You can save the following types of data in the columns with the XML data types: Untyped XML data To store the untyped XML data, you can use columns or variables with the XML data type. Typed XML data To store the typed XML data, you need to first register the schema associated with the data in the XML schema collection objects in the database. XQuery is a language that uses a set of statements and functions provided by the XML data type to extract data. ¤NIIT Instructor Inputs 3.5 Slide 4 Installing Windows XP Professional Using Attended Installation Slide 4 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Collaborate Session 3 Knowledge Byte (Contd.) The XQuery language includes the following statements: for Used to iterate through a set of nodes at the same level as in an XML document. let Used to declare variables and assign values. order by Used to specify a sequence. where Used to specify criteria for the data to be extracted. return Used to specify the XML returned from a statement. Slide 5 Installing Windows XP Professional Using Attended Installation Slide 5 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Collaborate Session 3 Knowledge Byte (Contd.) XQuery statements use the following functions provided by the XML data type: Query Used to extract XML from an XML data type. Value Used to return a single value from an XML document. Exist Used to check the existence of a node in an XML data. 3.6 Instructor Inputs ¤NIIT Slide 6 Installing Windows XP Professional Using Attended Installation Slide 6 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Colla borate Session 3 Best Practices The fastest schema changes occur when you: Add a column with the NULL property. Add a column with the NULL and DEFAULT properties. Change the NOT NULL property to NULL. Add the DEFAULT constraint. Drop the CHECK or DEFAULT constraint. To find out tables without a clustered index in a database use the following set of commands: use <database name> select distinct [Table] = object_name(object_id) from sys.indexes where index_id=0 and objectproperty(object_id,'IsUserTable')=1 order by [Table] Slide 7 Installing Windows XP Professional Using Attended Installation Slide 7 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Colla borate Session 3 Best Practices (Contd.) Improve performance by creating a clustered index. A clustered index physically orders the data in a table based on a single or composite column ¤NIIT Instructor Inputs 3.7 Slide 8 Installing Windows XP Professional Using Attended Installation Slide 8 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Collaborate Session 3 Tips and Tricks To change the date and time on the Windows server where SQL Server is installed, use the following script in Query Editor: USE master EXEC xp_cmdshell 'echo 06/16/2005 | date‘ EXEC xp_cmdshell 'echo 15:01:40 | time' To check whether the indexes created on your database are useful or not you can use sys.dm_db_index_usage_stats. Slide 9 Installing Windows XP Professional Using Attended Installation Slide 9 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Collaborate Session 3 Tips and Tricks (Contd.) To insert values from another table along with some literals, you can use the following syntax: INSERT INTO <table name> [(<col list>)] SELECT <collist>|<literal value> FROM <table name> To determine if a particular object is a table or a view, you can use the OBJECTPROPERTY metadata function. 3.8 Instructor Inputs ¤NIIT Slide 10 Installing Windows XP Professional Using Attended Installation Slide 10 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Colla borate Session 3 How maximum columns are allowed with each INSERT statement? The maximum columns allowed with each INSERT statement is 1024 columns. FAQs Slide 11 Installing Windows XP Professional Using Attended Installation Slide 11 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Colla borate Session 3 How many nonclustered indexes can be created on a table? You can create 249 non-clustered indexes on a table. FAQs (Contd.) ¤NIIT Instructor Inputs 3.9 Slide 12 Installing Windows XP Professional Using Attended Installation Slide 12 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Collaborate Session 3 By default on which key the clustered index is created? The clustered key is created on the Primary key by default. FAQs (Contd.) Slide 13 Installing Windows XP Professional Using Attended Installation Slide 13 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Collaborate Session 3 What is the maximum limit of creating partitions? The maximum limit of creating partitions is 1000. FAQs (Contd.) 3.10 Instructor Inputs ¤NIIT Slide 14 Installing Windows XP Professional Using Attended Installation Slide 14 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Colla borate Session 3 Does SQL Server 2000 have a support for partition tables? No, SQL Server 2000 does not support partition tables. FAQs (Contd.) Slide 15 Installing Windows XP Professional Using Attended Installation Slide 15 of 21 Ver. 1.0 Querying, Managing, and Administering Databases Using SQL Server 2005 Colla borate Session 3 How is the indexed view updated when any row is inserted, updated or deleted from a table? The SQL Server maintains the indexed views same as normal indexes. When the data is updated in a table the indexed view is automatically updated. FAQs (Contd.) [...]... also contains the index key values and the row locators that point to the storage location of the data in a table However, in a nonclustered index, the physical order of the rows is not the same as the index order Nonclustered indexes are typically created on columns used in joins and the WHERE clause These indexes can also be created on columns where the values are modified frequently 3.18 Instructor. .. processing time Discuss the different types of indexing In addition, discuss the different situations in which each index type is helpful Instructor Inputs You can conduct the discussion as follows: Encourage the students to discuss the different types of indexing Move the discussion to the situations where each index type is useful Solution The SQL Server allows you to create the following types of indexes:... index that sorts and stores the data rows in the table based on their key values Therefore, the data is physically sorted in the table when a clustered index is defined on it Only one clustered index can be created per table Therefore, you should build the index on attributes that have a high percentage of unique values and are not modified often Nonclustered Index Similar to the clustered index, a nonclustered... operation performed on a table The data of a table is stored on multiple data pages on the disk When a user queries a data value from the table, the query processor searches for the data value in all the data pages When it finds the data value, it returns the result set With an increasing volume of data, this process of querying data takes time Creating an index on a table solves the problem of slow query... of the following is a correct TRUNCATE statement? a TRUNCATE TABLE Emp b TRUNCATE EMP c TRUNCATE Emp WHERE Rt_Dt Answer: Ver 1.0 NIIT Collaborate Session 3 Slide 21 of 21 Instructor Inputs 3.13 Solutions to Challenge 1 2 3 4 5 d It is not stored as well-formed structure by the SQL Server c sort by b For c . Instructor Inputs Session 3 ¤NIIT Instructor Inputs 3. 3 This session includes the following topics:  Create an XML document  Storing XML data. Server 2005 Collaborate Session 3 By default on which key the clustered index is created? The clustered key is created on the Primary key by default. FAQs (Contd.) Slide 13 Installing Windows. 2005 Colla borate Session 3 Challenge (Contd.) Which of the following is not a function used by the XQuery language? Query For Value Exist Answer: For ¤NIIT Instructor Inputs 3. 13 Slide 20 Installing

Ngày đăng: 31/07/2014, 15:20

Tài liệu cùng người dùng

Tài liệu liên quan