This session includes the following topics: .Net framework SQL Server tools Grouping data using the UNPIVOT operator Best practices Tips and Tricks Slide 1 Installing Windows X
Trang 1Instructor Inputs S e
Trang 3This session includes the following topics:
Net framework
SQL Server tools
Grouping data using the UNPIVOT operator
Best practices
Tips and Tricks
Slide 1
Installing Windows XP Professional Using Attended Installation
Slide 1 of 14
Ver 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Objectives
Collaborate Session 1
In this session, you will learn about:
.NET Framework SQL Server 2005 tools Grouping data by using the UNPIVOT operator Best Practices while using the query statements in SQL Server 2005
Tips and Tricks that will help you perform effective query by using SQL Server 2005
FAQs related to general concepts of SQL Server 2005
Trang 4Slide 2 of 14
Ver 1.0
Knowledge Byte
Collaborate Session 1
.Net Framework:
Is an environment used to build, deploy, and run business applications
Is designed to make significant improvements in code reuse, code specialization, resource management, multilanguage development, security, deployment, and administration.
Consists of the following components:
Development tools and languages Base Class Library
Common Language Runtime (CLR)
Slide 3
Installing Windows XP Professional Using Attended Installation Querying, Managing, and Administering Databases Using SQL Server 2005
Knowledge Byte (Contd.)
SQL Server 2005 provides various tools that help improve the efficiency of database developers
Some of the tools are:
SQL Server Management Studio:
Is a powerful tool associated with SQL Server 2005 Provides a simple and integrated environment for developing and managing the SQL Server database objects
Business Intelligence Development Studio:
Is a tool that provides an environment to develop business intelligence solutions
Solutions are based on the data that was generated in the organization and helps in business forecasting and making strategic decisions and future
Trang 5Slide 4 of 14
Ver 1.0
Knowledge Byte (Contd.)
Collaborate Session 1
Database Engine Tuning Advisor:
Helps database administrators to analyze and tune the performance of the server
SQL Server Configuration Manager:
Helps the database administrators to manage the services associated with the SQL Server
UNPIVOT operator:
Allows database users to normalize the data that has earlier been pivoted
Transforms the multiple column values of a record into multiple records with the same values in a single column
Slide 5
Installing Windows XP Professional Using Attended Installation Querying, Managing, and Administering Databases Using SQL Server 2005
Best Practices
When you write stored procedures, triggers, and user-defined functions, first decide whether to use traditional Transact-SQL or a programming language that is
compatible with the NET Framework, such as Visual Basic NET or C#.
Use Transact-SQL where the code primarily performs data access with little or no procedural logic
Use programming languages when you have computationally-intensive functions and procedures that feature complex logic or for situations where you want to take advantage of the NET Framework class library.
To rotate the data of a table use the PIVOT and UNPIVOT operators, instead of using complex JOIN statements.
Trang 6Slide 6 of 14
Ver 1.0
Best Practices (Contd.)
Use the new data types VARCHAR(MAX), NVARCHAR(MAX), and VARBINARY(MAX) for storing long columns.
In the Query Editor Results window, use the Options tab in Management Studio to set the maximum column size under the Results section
Keep the result sets that you return from your database small to improve performance.
Collaborate Session 1
Slide 7
Installing Windows XP Professional Using Attended Installation Querying, Managing, and Administering Databases Using SQL Server 2005
Tips and Tricks
When writing calculation expressions such as “expr1 * expr2”, ensure that the expression sweeping the largest area/volume is on the left side
Consider replacing simple “Measure1 + Measure2”
calculations with computed columns in the SQL data source.
Avoid using Select * in your query design Instead, ensure that you use the proper column names in the query
Trang 7Slide 8 of 14
Ver 1.0
What are the two new components introduced with SQL Server 2005?
The two new components introduced with SQL are:
SQL Server Management Studio SQL Server Business Intelligence Development Studio
Can we use the PIVOT and UNPIVOT operators in SQL Server 2000?
No, SQL Server 2000 does not support the PIVOT and UNPIVOT operators To achieve the same functionality as that
of the PIVOT and UNPIVOT operators, you can use JOINS in SQL Server 2000.
FAQs
Collaborate Session 1
Slide 9
Installing Windows XP Professional Using Attended Installation Querying, Managing, and Administering Databases Using SQL Server 2005
Which framework is supported by SQL Server 2005?
SQL Server 2005 supports Framework V2.0.
Which application architecture does SQL Server 2005 support?
SQL Server 2005 supports n-tier architecture.
Which service of SQL Server 2005 allows you to gather and integrate data from various disparate data sources available
in an organization?
Integration services of SQL Server 2005 allow you to gather and integrate data from various disparate data sources available in an organization.
FAQs (Contd.)
Trang 8Slide 10 of 14
Ver 1.0
Challenge
Collaborate Session 1
Which of the following is not a component of the NET Framework?
Development tools and languages Base class library
Service Broker Common Language Runtime
Answer:
Service Broker
Slide 11
Installing Windows XP Professional Using Attended Installation Querying, Managing, and Administering Databases Using SQL Server 2005
Challenge (Contd.)
Which of the following component of the NET Framework is used to create the interface for the Windows forms?
Base class library Service Broker Development tools and languages Common Language Runtime
Answer:
Development tools and languages
Trang 9Slide 12 of 14
Ver 1.0
Challenge (Contd.)
Collaborate Session 1
Which component of the NET Framework provides an environment for the application to run?
Development tools and languages Base class library
Security Management Common Language Runtime
Answer:
Common Language Runtime
Slide 13
Installing Windows XP Professional Using Attended Installation Querying, Managing, and Administering Databases Using SQL Server 2005
Challenge (Contd.)
Which of the following is not a feature provided by the common language runtime?
Service-oriented architecture Language interoperability Automatic memory management Platform independence
Answer:
Service-oriented architecture
Trang 10Slide 14 of 14
Ver 1.0
Challenge (Contd.)
Collaborate Session 1
Which of the following is not a main component of the SQL Server Management Studio interface?
Solution Explorer Query Editor Object Explorer SQL Server Client Agent
Answer:
SQL Server Client Agent
Trang 111 c Service Broker
2 c Development tools and languages
3 d Common Language Runtime
4 a Service-oriented architecture
5 d SQL Server Client Agent
Trang 121 What is the maximum length of NVARCHAR data type?
a 8000 characters
b 6000 characters
c 4000 characters
d 400 characters
2 Which of the following data type does not store integer value?
a tinyint
b int
c smallint
d decimal
3 Which operator is used to change the precedence of the arithmetic operators in SQL queries?
a \
b [ ]
c ( )
d { }
4 Which of the following query retrieves the record of the students who are studying in
a class higher than class 10?
a SELECT * FROM Student WHERE NOT class<=10
b SELECT * FROM Student WHERE class=10
c SELECT * FROM Student WHERE class>=10
d SELECT * FROM Student WHERE NOT class>=10
5 Which of the following query retrieves the names of the cities that start with letter M and whose fourth letter is B?
a SELECT City FROM City_List WHERE City LIKE ‘M_ B_%’
b SELECT City FROM City_List WHERE City LIKE ‘M_ _ B[]’
c SELECT City FROM City_List WHERE City LIKE ‘M_ _ B%’
d SELECT City FROM City_List WHERE City LIKE ‘M% B%’
Trang 13b DCL
c DDL
d DQL
8 Which data type is used to store fixed length character data?
a text
b varchar(n)
c char(n)
d nchar
9 Which clause allows you to group data in a SELECT statement?
a WHERE
b HAVING
c ORDER BY
d COMPUTE BY
10 Which group operator is used to transform a set of columns into values?
a COMPUTE
b COMPUTE BY
c GROUP BY
d PIVOT
Solutions
1 4000 characters
2 decimal
3 ( )
4 SELECT * FROM Student WHERE NOT class<=10
5 SELECT City FROM City_List WHERE City LIKE ‘M_ _ B%’
6 Analysis services
Trang 14SQL Server 2005 provides a data management solution for the organization It allows secure and efficient storage and management of data In addition, SQL Server 2005 provides other components and services that support the business intelligence platform to generate reports and facilitate data analysis
Discuss the role of each core component of SQL Server 2005 in an enterprise
environment
Instructor Inputs
You can conduct the discussion as follows:
Begin the discussion by listing the different core components of SQL Server 2005
Encourage the students to discuss about the data management support of database engine
Continue the discussion by mentioning about the data integration requirement of the enterprises and role of Integration services in this context
Move the discussion to the need of analysis services and reporting services
Solution
The different core components of SQL Server 2005 are as follows:
Database Engine
Integration Services
Analysis Services
Reporting Services
Database Engine
The database engine provides support to store, query, process, and secure data on the database server The database engine contains databases and database objects, such as
Trang 15users or administrators about any event.
Integration Services
Organizations have their old data in the legacy data storage systems This data they may
require in future for some analysis purposes Integration services allow you to gather and
integrate data from various disparate data sources available in an organization
Organizations can also have different branches and these branches of the organization
may use different data storage technologies to store the operational data You can store
the data in a consistent format in a common database called the data warehouse using the
Integration services
Data is contributed from multiple branches of an organization, each using different
conventions and standards Before the data can be used, it may need to be formatted
differently For example, you may need to combine the first name and the last name into
one column This standardization of the data can be done using Integration services
Analysis Services
Analysis services help in data analysis in a BI application These applications are built on
a data warehouse that contains data consolidated from various data sources These
services provide data mining solutions that are built on data integrated in the data
warehouse
Reporting Services
Reporting services provide support to generate comprehensive reports on data in the
database engine or in the data warehouse These services provide a set of tools that help in
creating and managing different types of reports in different formats