SlideShare a Scribd company logo
1 of 35
Querying and Managing Data Using SQL Server 2005
Rationale


                Aspiring Database Developers should be able to efficiently
                query and maintain databases.
                This module will help students learn the Structured Query
                Language (SQL) to query and manage databases.




     Ver. 1.0                      Session 1                        Slide 1 of 35
Querying and Managing Data Using SQL Server 2005
Objectives


                In this session, you will learn to:
                   Appreciate SQL Server 2005 as a database server
                   Identify the SQL Server 2005 tools
                   Retrieve data




     Ver. 1.0                        Session 1                       Slide 2 of 35
Querying and Managing Data Using SQL Server 2005
Role of a Database Server


                Business applications consist of three elements:
                   The user interface or the presentation element
                   The application logic or the business rule element
                   The data storage or the data management element
                The application architectures can be categorized as:
                   Single-tier architecture
                   Two-tier architecture
                   Three-tier architecture
                   N-tier architecture




     Ver. 1.0                         Session 1                         Slide 3 of 35
Querying and Managing Data Using SQL Server 2005
SQL Server 2005 Components


               SQL Server 2005 consists of the following components.


                              Database Engine
                   Service                    Full-Text   Notification
                             Replication
                   Broker                      Search      Services

                             Integration Services
                              Analysis Services
                             Reporting Services




    Ver. 1.0                      Session 1                              Slide 4 of 35
Querying and Managing Data Using SQL Server 2005
SQL Server 2005 Components (Contd.)


                Microsoft SQL Server 2005 is integrated with the .NET
                Framework.




                                                                           .NET Framework
                                Database Engine
                    Service                    Full-Text   Notification
                              Replication
                    Broker                      Search      Services

                              Integration Services
                               Analysis Services
                               Reporting Services




     Ver. 1.0                      Session 1                              Slide 5 of 35
Querying and Managing Data Using SQL Server 2005
Just a minute


                Which of the following services of SQL Server 2005 allows
                you to implement message-based communication?
                 1.   Full-text search
                 2.   Service Broker
                 3.   Notification services
                 4.   Replication




                Answer:
                2. Service Broker




     Ver. 1.0                           Session 1                  Slide 6 of 35
Querying and Managing Data Using SQL Server 2005
Just a minute


                Which of the following services of SQL Server 2005 allows
                you to gather and integrate data from disparate data
                sources in an organization?
                 1.   Analysis services
                 2.   Integration services
                 3.   Notification services
                 4.   Replication




                Answer:
                 2. Integration services




     Ver. 1.0                           Session 1                  Slide 7 of 35
Querying and Managing Data Using SQL Server 2005
Features of SQL Server 2005


                SQL Server 2005 provides the following features:
                   Built-in support for Extensible Markup Language (XML) data
                   CLR integration
                   Scalability
                   Service-oriented architecture
                   Support for Web services
                   High level of security
                   High availability
                   Support for data migration and analysis




     Ver. 1.0                       Session 1                           Slide 8 of 35
Querying and Managing Data Using SQL Server 2005
Structured Query Language (SQL)


                SQL is the core language used to:
                   Store data
                   Retrieve and manipulate data
                   Modify data
                SQL can be categorized as:
                   Data Definition Language (DDL)
                   Data Manipulation Language (DML)
                   Data Control Language (DCL)
                   Data Query Language (DQL)




     Ver. 1.0                       Session 1         Slide 9 of 35
Querying and Managing Data Using SQL Server 2005
Just a minute


                Which of the following features of SQL Server 2005 allow
                the developers to implement their programming logic in any
                language supported by the .NET framework?
                 1.   Support for data migration
                 2.   High availability
                 3.   CLR integration
                 4.   Scalability




                Answer:
                 3. CLR integration




     Ver. 1.0                          Session 1                   Slide 10 of 35
Querying and Managing Data Using SQL Server 2005
Identifying SQL Server 2005 Tools


                SQL Server 2005 provides the following tools:
                   SQL Server Management Studio
                   SQL Server Business Intelligence Development Studio
                   Database Engine Tuning Advisor
                   SQL Server Configuration Manager




     Ver. 1.0                      Session 1                             Slide 11 of 35
Querying and Managing Data Using SQL Server 2005
Just a minute


                Which of the following tools of SQL Server 2005 allow
                starting and stopping the full-text search?
                 1.   SQL Server Management Studio
                 2.   Business Intelligence Development Studio
                 3.   Database Engine Tuning Advisor
                 4.   SQL Server Configuration Manager




                Answer:
                 4. SQL Server Configuration Manager




     Ver. 1.0                         Session 1                    Slide 12 of 35
Querying and Managing Data Using SQL Server 2005
Identifying Data Types


                Data types:
                   Specify the type of data that an object can contain
                   Commonly used by SQL Server are:
                       int
                       float
                       char
                       varchar




     Ver. 1.0                        Session 1                           Slide 13 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Specific Attributes


                Specific attributes can be retrieved by specifying selected
                column names in the SELECT statement.
                Syntax:
                 SELECT [ALL | DISTINCT] select_column_list
                 [INTO [new_table_name]]
                 FROM {table_name | view_name}
                 [WHERE search_condition]
                 [GROUP BY group_by_expression]
                 [HAVING search_condition]
                 [ORDER BY order_expression [ASC | DESC]]
                 [COMPUTE
                 {{ AVG | COUNT | MAX | MIN | SUM } ( expression
                 ) } [,...n ] [ BY expression [ ,...n ] ]
                Let’s see how…

     Ver. 1.0                       Session 1                         Slide 14 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Specific Attributes (Contd.)


                Display of the result set can be customized using:
                   User-defined headings
                   Literals
                   Concatenation operators
                Let’s see how…




     Ver. 1.0                      Session 1                         Slide 15 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Specific Attributes (Contd.)


                Column values can be calculated using arithmetic
                operators:
                   + (for addition)
                   - (for subtraction)
                   / (for division)
                   * (for multiplication)
                   % (for modulo)
                Let’s see how…




     Ver. 1.0                          Session 1                   Slide 16 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Selected Rows


                Selected rows can be retrieved using the WHERE clause in
                the SELECT statement.
                Let’s see how…




     Ver. 1.0                     Session 1                      Slide 17 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Selected Rows (Contd.)


                Comparison operators:
                   Can be used with WHERE clause to create conditions
                   Supported by SQL Server are:
                    •   = (equal to)
                    •   > (greater than)
                    •   < (less than) and many more
                   Syntax:
                    SELECT column_list
                    FROM table_name
                    WHERE expression1 comparison_operator
                    expression2
                Let’s see how…




     Ver. 1.0                         Session 1                         Slide 18 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Selected Rows (Contd.)


                Logical operators:
                   Can be used with SELECT statement to retrieve records based
                   on one or more matching conditions
                   Supported by SQL Server are:
                     • AND
                     • OR
                     • NOT
                   Syntax:
                    SELECT column_list
                    FROM table_name
                    WHERE conditional_expression1 {AND/OR} [NOT]

                     conditional_expression2
                Let’s see how…

     Ver. 1.0                        Session 1                        Slide 19 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Selected Rows (Contd.)


                Range operators:
                   Can be used with SELECT statement to retrieve records based
                   on a range
                   Supported by SQL Server are:
                    •   BETWEEN
                    •   NOT BETWEEN
                   Syntax:
                    SELECT column_list
                    FROM table_name
                    WHERE expression1 range_operator expression2
                    AND expression3
                Let’s see how…




     Ver. 1.0                      Session 1                          Slide 20 of 35
Querying and Managing Data Using SQL Server 2005
Just a minute


                Which of the following are logical operators?
                 1.   BETWEEN and NOT BETWEEN
                 2.   AND, OR, and NOT
                 3.   + and %
                 4.   > and <




                Answer:
                 2. AND, OR, and NOT




     Ver. 1.0                      Session 1                    Slide 21 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Selected Rows (Contd.)


                IN keyword:
                   Allows the selection of values that match any one of the values
                   in a list
                NOT IN keyword:
                   Restricts the selection of values that match any one of the
                   values in a list
                Syntax:
                 SELECT column_list
                 FROM table_name
                 WHERE expression list_operator
                 (‘value_list’)
                Let’s see how…



     Ver. 1.0                        Session 1                            Slide 22 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Selected Rows (Contd.)


                  LIKE keyword:
                     Can be used to search for character string, date, or time values
                     that match a specified pattern
                     Uses wildcard characters like *, % to perform pattern match
                  Let’s see how…
                • NULL values:
                     Can be retrieved by using IS NULL keyword with SELECT
                     statement
                     Syntax:
                       SELECT column_list
                       FROM table_name
                       WHERE column_name unknown_value_operator
                  Let’s see how…


     Ver. 1.0                          Session 1                            Slide 23 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Selected Rows (Contd.)


                ORDER BY clause:
                   Can be used with the SELECT statement to display records in
                   a specific order
                   Displays record in ascending or in descending order
                   Syntax:
                     SELECT select_list
                     FROM table_name
                     [ORDER BY order_by_expression [ASC|DESC]
                     [, order_by_expression [ASC|DESC]…]
                Let’s see how…




     Ver. 1.0                       Session 1                          Slide 24 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Selected Rows (Contd.)


                TOP keyword:
                   Can be used with the SELECT statement to retrieve only the
                   first set of rows, which can be either a number or a percent of
                   rows
                   Syntax:
                      SELECT [TOP n [PERCENT]] column_name
                      [,column_name…]
                      FROM table_name
                      WHERE search_conditions
                      [ORDER BY [column_name[,column_name…]
                Let’s see how…




     Ver. 1.0                        Session 1                             Slide 25 of 35
Querying and Managing Data Using SQL Server 2005
Retrieving Selected Rows (Contd.)


                DISTINCT keyword:
                   Can be used with the SELECT statement to eliminate duplicate
                   rows
                   Syntax:
                     SELECT [ALL|DISTINCT] column_names
                     FROM table_name
                     WHERE search_condition
                Let’s see how…




     Ver. 1.0                       Session 1                          Slide 26 of 35
Querying and Managing Data Using SQL Server 2005
Just a minute


                Write a query to display all the records of the ProductModel
                table where the product name begins with HL.




                Answer:
                    SELECT * FROM Production.ProductModel
                    WHERE Name LIKE 'HL%'



     Ver. 1.0                      Session 1                         Slide 27 of 35
Querying and Managing Data Using SQL Server 2005
Demo: Retrieving Data


                Problem Statement:
                   You are a database developer of AdventureWorks, Inc. The
                   AdventureWorks database is stored on the SQLSERVER01
                   database server. The details of the sales persons are stored in
                   the SalesPerson table. The management wants to view the
                   details of the top three sales persons who have earned a
                   bonus between $4,000 and $6,000.
                   How will you generate this report?




     Ver. 1.0                        Session 1                            Slide 28 of 35
Querying and Managing Data Using SQL Server 2005
Demo: Retrieving Data (Contd.)


                Solution:
                   To solve the preceding problem, you need to perform the
                   following tasks:
                     1. Create a query.
                     2. Execute the query to generate the report.




     Ver. 1.0                          Session 1                        Slide 29 of 35
Querying and Managing Data Using SQL Server 2005
Summary


               In this session, you learned that:
                  A business application can have three elements: user
                  interface, business logic, and data storage.
                  A database server is used to store and manage database in a
                  business application.
                  SQL Server 2005 consists of the following four core
                  components: database engine, integration services, analysis
                  services, and reporting services.
                  The database engine provides support to store, query,
                  process, and secure data on the database server.
                  Integration services allow you to gather and integrate data from
                  disparate data sources at a common location in a consistent
                  format.




    Ver. 1.0                        Session 1                            Slide 30 of 35
Querying and Managing Data Using SQL Server 2005
Summary (Contd.)


               Analysis services provide data mining solutions that help in
               data analysis.
               Reporting services provide support to generate comprehensive
               reports on the data stored in the database engine or the data
               warehouse.
               Microsoft SQL Server 2005 is integrated with the .NET
               Framework.
               The .NET Framework is an environment used to build, deploy,
               and run business applications through various programming
               languages.
               The .NET Framework consists of three components:
               development tools and languages, base class library, and CLR.




    Ver. 1.0                    Session 1                          Slide 31 of 35
Querying and Managing Data Using SQL Server 2005
Summary (Contd.)


               SQL Server 2005 provides the following benefits:
                •   Built-in support for XML
                •   CLR integration
                •   Scalability
                •   Service-oriented architecture
                •   Support for Web services
                •   High level of security
                •   High availability
                •   Support for data migration and analysis
               SQL includes:
                •   DDL: To create and manage database objects
                •   DML: To store and manage data in database objects
                •   DCL: To allow or deny access to database objects
                •   DQL: To query data from the database objects




    Ver. 1.0                       Session 1                            Slide 32 of 35
Querying and Managing Data Using SQL Server 2005
Summary (Contd.)


               SQL Server 2005 provides the following tools to improve the
               efficiency of the database developers and manage the server:
                •   SQL Server Management Studio
                •   SQL Server Business Intelligence Management Studio
                •   Database Engine Tuning Advisor
                •   SQL Server Configuration Manager
               Data can be retrieved from a database by using the SELECT
               statement.
               Data of all the columns of a table can be retrieved by
               specifying * in the select query.
               Data that has to be retrieved based on a condition is specified
               by adding the WHERE clause.
               Literals and user-defined headings are added to change the
               display.
               The concatenation operator is used to concatenate a string
               expression.
    Ver. 1.0                      Session 1                              Slide 33 of 35
Querying and Managing Data Using SQL Server 2005
Summary (Contd.)


               – Arithmetic operators are used to perform mathematical
                 operations.
               – Comparison operators test the similarity between two
                 expressions.
               – Logical operators are used in the SELECT statement to
                 retrieve records based on one or matching conditions. The
                 logical operators are AND, OR, and NOT.
               – The Range operator retrieves data based on the range. There
                 are of two types of range operators, BETWEEN and NOT
                 BETWEEN.
               – The IN keyword allows the selection of values that match any
                 one of the values in a list.
               – The NOT IN keyword restricts the selection of values that
                 match any one of the values in a list.



    Ver. 1.0                      Session 1                           Slide 34 of 35
Querying and Managing Data Using SQL Server 2005
Summary (Contd.)


               The LIKE keyword is used to specify the pattern search.
               The IS NULL keyword is used to retrieve missing values.
               The ORDER BY clause is used to retrieve data in a specific
               order.
               The TOP keyword retrieves only the first set of rows, which can
               either be a number or a percent of rows that will be returned
               from a query result.
               The DISTINCT keyword eliminates duplicate rows.




    Ver. 1.0                     Session 1                           Slide 35 of 35

More Related Content

What's hot

Java session16
Java session16Java session16
Java session16Niit Care
 
Vskills certified enterprise applications integration specialist with micros...
Vskills certified enterprise applications integration specialist  with micros...Vskills certified enterprise applications integration specialist  with micros...
Vskills certified enterprise applications integration specialist with micros...Vskills
 
An overview of microsoft data mining technology
An overview of microsoft data mining technologyAn overview of microsoft data mining technology
An overview of microsoft data mining technologyMark Tabladillo
 
An overview of Microsoft data mining technology
An overview of Microsoft data mining technologyAn overview of Microsoft data mining technology
An overview of Microsoft data mining technologyMark Tabladillo
 
Sql server 2012 roadshow masd overview 003
Sql server 2012 roadshow masd overview 003Sql server 2012 roadshow masd overview 003
Sql server 2012 roadshow masd overview 003Mark Kromer
 
Ict curriculum roadmap
Ict curriculum roadmapIct curriculum roadmap
Ict curriculum roadmapinterviz
 
Material modulo04 asf6501(6425-a_01)
Material   modulo04 asf6501(6425-a_01)Material   modulo04 asf6501(6425-a_01)
Material modulo04 asf6501(6425-a_01)JSantanderQ
 
Material modulo01 asf6501(6419-a_01)
Material   modulo01 asf6501(6419-a_01)Material   modulo01 asf6501(6419-a_01)
Material modulo01 asf6501(6419-a_01)JSantanderQ
 
Sql Server 2008 Security Enhanments
Sql Server 2008 Security EnhanmentsSql Server 2008 Security Enhanments
Sql Server 2008 Security EnhanmentsEduardo Castro
 
Material modulo03 asf6501(6425-b_02)
Material   modulo03 asf6501(6425-b_02)Material   modulo03 asf6501(6425-b_02)
Material modulo03 asf6501(6425-b_02)JSantanderQ
 
10 qmds2005 session14
10 qmds2005 session1410 qmds2005 session14
10 qmds2005 session14Niit Care
 
SQL Sevrer 2008 R2 Overview
SQL Sevrer 2008 R2 OverviewSQL Sevrer 2008 R2 Overview
SQL Sevrer 2008 R2 OverviewMark Kromer
 
What's new in SQL Server 2012 for philly code camp 2012.1
What's new in SQL Server 2012 for philly code camp 2012.1What's new in SQL Server 2012 for philly code camp 2012.1
What's new in SQL Server 2012 for philly code camp 2012.1Mark Kromer
 
All adapterscommonproperties
All adapterscommonpropertiesAll adapterscommonproperties
All adapterscommonpropertiesXAVIERCONSULTANTS
 

What's hot (17)

Java session16
Java session16Java session16
Java session16
 
6232 b 04
6232 b 046232 b 04
6232 b 04
 
Vskills certified enterprise applications integration specialist with micros...
Vskills certified enterprise applications integration specialist  with micros...Vskills certified enterprise applications integration specialist  with micros...
Vskills certified enterprise applications integration specialist with micros...
 
An overview of microsoft data mining technology
An overview of microsoft data mining technologyAn overview of microsoft data mining technology
An overview of microsoft data mining technology
 
An overview of Microsoft data mining technology
An overview of Microsoft data mining technologyAn overview of Microsoft data mining technology
An overview of Microsoft data mining technology
 
Sql server 2012 roadshow masd overview 003
Sql server 2012 roadshow masd overview 003Sql server 2012 roadshow masd overview 003
Sql server 2012 roadshow masd overview 003
 
Microsoft Certification Roadmap for Students
Microsoft Certification Roadmap for StudentsMicrosoft Certification Roadmap for Students
Microsoft Certification Roadmap for Students
 
Ict curriculum roadmap
Ict curriculum roadmapIct curriculum roadmap
Ict curriculum roadmap
 
Material modulo04 asf6501(6425-a_01)
Material   modulo04 asf6501(6425-a_01)Material   modulo04 asf6501(6425-a_01)
Material modulo04 asf6501(6425-a_01)
 
Sql server 2008 certifikati
Sql server 2008 certifikatiSql server 2008 certifikati
Sql server 2008 certifikati
 
Material modulo01 asf6501(6419-a_01)
Material   modulo01 asf6501(6419-a_01)Material   modulo01 asf6501(6419-a_01)
Material modulo01 asf6501(6419-a_01)
 
Sql Server 2008 Security Enhanments
Sql Server 2008 Security EnhanmentsSql Server 2008 Security Enhanments
Sql Server 2008 Security Enhanments
 
Material modulo03 asf6501(6425-b_02)
Material   modulo03 asf6501(6425-b_02)Material   modulo03 asf6501(6425-b_02)
Material modulo03 asf6501(6425-b_02)
 
10 qmds2005 session14
10 qmds2005 session1410 qmds2005 session14
10 qmds2005 session14
 
SQL Sevrer 2008 R2 Overview
SQL Sevrer 2008 R2 OverviewSQL Sevrer 2008 R2 Overview
SQL Sevrer 2008 R2 Overview
 
What's new in SQL Server 2012 for philly code camp 2012.1
What's new in SQL Server 2012 for philly code camp 2012.1What's new in SQL Server 2012 for philly code camp 2012.1
What's new in SQL Server 2012 for philly code camp 2012.1
 
All adapterscommonproperties
All adapterscommonpropertiesAll adapterscommonproperties
All adapterscommonproperties
 

Viewers also liked

Viewers also liked (6)

Third eye designers
Third eye designersThird eye designers
Third eye designers
 
Informe 720
Informe 720Informe 720
Informe 720
 
Comunicato 30
Comunicato 30Comunicato 30
Comunicato 30
 
Sunscreen
SunscreenSunscreen
Sunscreen
 
Busqueda de informacion en internet
Busqueda de informacion en internetBusqueda de informacion en internet
Busqueda de informacion en internet
 
04 qmds2005 session05
04 qmds2005 session0504 qmds2005 session05
04 qmds2005 session05
 

Similar to 01 qmds2005 session01

03 qmds2005 session03
03 qmds2005 session0303 qmds2005 session03
03 qmds2005 session03Niit Care
 
08 qmds2005 session11
08 qmds2005 session1108 qmds2005 session11
08 qmds2005 session11Niit Care
 
Admin Tech Ed Presentation Hardening Sql Server
Admin Tech Ed Presentation   Hardening Sql ServerAdmin Tech Ed Presentation   Hardening Sql Server
Admin Tech Ed Presentation Hardening Sql Serverrsnarayanan
 
SQL Server Developer 70-433
SQL Server Developer 70-433SQL Server Developer 70-433
SQL Server Developer 70-433jasonyousef
 
SQL Server 2008 Highlights
SQL Server 2008 HighlightsSQL Server 2008 Highlights
SQL Server 2008 HighlightsIntergen
 
Professional sql server 2005 clr programming
Professional sql server 2005 clr programmingProfessional sql server 2005 clr programming
Professional sql server 2005 clr programmingjoeljie
 
SQL Server 2008 certification
SQL Server 2008 certificationSQL Server 2008 certification
SQL Server 2008 certificationVskills
 
Sql server ___________session 1(sql 2008)
Sql server  ___________session 1(sql 2008)Sql server  ___________session 1(sql 2008)
Sql server ___________session 1(sql 2008)Ehtisham Ali
 
6232 b 01
6232 b 016232 b 01
6232 b 01stamal
 
Bi For It Professionals Part 3 Building And Querying Multidimensional Cubes
Bi For It Professionals Part 3   Building And Querying Multidimensional CubesBi For It Professionals Part 3   Building And Querying Multidimensional Cubes
Bi For It Professionals Part 3 Building And Querying Multidimensional CubesMicrosoft TechNet
 
05 qmds2005 session07
05 qmds2005 session0705 qmds2005 session07
05 qmds2005 session07Niit Care
 
Sql server licensing_guide_partneredn_v1-1
Sql server licensing_guide_partneredn_v1-1Sql server licensing_guide_partneredn_v1-1
Sql server licensing_guide_partneredn_v1-1guestd54e35
 
Tier1 SQL Server Managed Services
Tier1 SQL Server Managed ServicesTier1 SQL Server Managed Services
Tier1 SQL Server Managed ServicesToby Schwab
 
Session 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufSession 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufCTE Solutions Inc.
 
Securing and maintaining azure sql
Securing and maintaining azure sqlSecuring and maintaining azure sql
Securing and maintaining azure sqlStas Lebedenko
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developerswebhostingguy
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hydewebhostingguy
 

Similar to 01 qmds2005 session01 (20)

03 qmds2005 session03
03 qmds2005 session0303 qmds2005 session03
03 qmds2005 session03
 
08 qmds2005 session11
08 qmds2005 session1108 qmds2005 session11
08 qmds2005 session11
 
Admin Tech Ed Presentation Hardening Sql Server
Admin Tech Ed Presentation   Hardening Sql ServerAdmin Tech Ed Presentation   Hardening Sql Server
Admin Tech Ed Presentation Hardening Sql Server
 
SQL Server Developer 70-433
SQL Server Developer 70-433SQL Server Developer 70-433
SQL Server Developer 70-433
 
SQL Server 2008 Highlights
SQL Server 2008 HighlightsSQL Server 2008 Highlights
SQL Server 2008 Highlights
 
Professional sql server 2005 clr programming
Professional sql server 2005 clr programmingProfessional sql server 2005 clr programming
Professional sql server 2005 clr programming
 
SQL Server 2008 certification
SQL Server 2008 certificationSQL Server 2008 certification
SQL Server 2008 certification
 
Sql server ___________session 1(sql 2008)
Sql server  ___________session 1(sql 2008)Sql server  ___________session 1(sql 2008)
Sql server ___________session 1(sql 2008)
 
6232 b 01
6232 b 016232 b 01
6232 b 01
 
Bi For It Professionals Part 3 Building And Querying Multidimensional Cubes
Bi For It Professionals Part 3   Building And Querying Multidimensional CubesBi For It Professionals Part 3   Building And Querying Multidimensional Cubes
Bi For It Professionals Part 3 Building And Querying Multidimensional Cubes
 
Sql server dba training
Sql server dba trainingSql server dba training
Sql server dba training
 
05 qmds2005 session07
05 qmds2005 session0705 qmds2005 session07
05 qmds2005 session07
 
Sql server licensing_guide_partneredn_v1-1
Sql server licensing_guide_partneredn_v1-1Sql server licensing_guide_partneredn_v1-1
Sql server licensing_guide_partneredn_v1-1
 
Tier1 SQL Server Managed Services
Tier1 SQL Server Managed ServicesTier1 SQL Server Managed Services
Tier1 SQL Server Managed Services
 
Sql Sever Presentation.pptx
Sql Sever Presentation.pptxSql Sever Presentation.pptx
Sql Sever Presentation.pptx
 
Session 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufSession 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian Malbeuf
 
Securing and maintaining azure sql
Securing and maintaining azure sqlSecuring and maintaining azure sql
Securing and maintaining azure sql
 
Confio presentation
Confio presentationConfio presentation
Confio presentation
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developers
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hyde
 

More from Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 

Recently uploaded

AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseWSO2
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governanceWSO2
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaWSO2
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingWSO2
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringWSO2
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 

Recently uploaded (20)

AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 

01 qmds2005 session01

  • 1. Querying and Managing Data Using SQL Server 2005 Rationale Aspiring Database Developers should be able to efficiently query and maintain databases. This module will help students learn the Structured Query Language (SQL) to query and manage databases. Ver. 1.0 Session 1 Slide 1 of 35
  • 2. Querying and Managing Data Using SQL Server 2005 Objectives In this session, you will learn to: Appreciate SQL Server 2005 as a database server Identify the SQL Server 2005 tools Retrieve data Ver. 1.0 Session 1 Slide 2 of 35
  • 3. Querying and Managing Data Using SQL Server 2005 Role of a Database Server Business applications consist of three elements: The user interface or the presentation element The application logic or the business rule element The data storage or the data management element The application architectures can be categorized as: Single-tier architecture Two-tier architecture Three-tier architecture N-tier architecture Ver. 1.0 Session 1 Slide 3 of 35
  • 4. Querying and Managing Data Using SQL Server 2005 SQL Server 2005 Components SQL Server 2005 consists of the following components. Database Engine Service Full-Text Notification Replication Broker Search Services Integration Services Analysis Services Reporting Services Ver. 1.0 Session 1 Slide 4 of 35
  • 5. Querying and Managing Data Using SQL Server 2005 SQL Server 2005 Components (Contd.) Microsoft SQL Server 2005 is integrated with the .NET Framework. .NET Framework Database Engine Service Full-Text Notification Replication Broker Search Services Integration Services Analysis Services Reporting Services Ver. 1.0 Session 1 Slide 5 of 35
  • 6. Querying and Managing Data Using SQL Server 2005 Just a minute Which of the following services of SQL Server 2005 allows you to implement message-based communication? 1. Full-text search 2. Service Broker 3. Notification services 4. Replication Answer: 2. Service Broker Ver. 1.0 Session 1 Slide 6 of 35
  • 7. Querying and Managing Data Using SQL Server 2005 Just a minute Which of the following services of SQL Server 2005 allows you to gather and integrate data from disparate data sources in an organization? 1. Analysis services 2. Integration services 3. Notification services 4. Replication Answer: 2. Integration services Ver. 1.0 Session 1 Slide 7 of 35
  • 8. Querying and Managing Data Using SQL Server 2005 Features of SQL Server 2005 SQL Server 2005 provides the following features: Built-in support for Extensible Markup Language (XML) data CLR integration Scalability Service-oriented architecture Support for Web services High level of security High availability Support for data migration and analysis Ver. 1.0 Session 1 Slide 8 of 35
  • 9. Querying and Managing Data Using SQL Server 2005 Structured Query Language (SQL) SQL is the core language used to: Store data Retrieve and manipulate data Modify data SQL can be categorized as: Data Definition Language (DDL) Data Manipulation Language (DML) Data Control Language (DCL) Data Query Language (DQL) Ver. 1.0 Session 1 Slide 9 of 35
  • 10. Querying and Managing Data Using SQL Server 2005 Just a minute Which of the following features of SQL Server 2005 allow the developers to implement their programming logic in any language supported by the .NET framework? 1. Support for data migration 2. High availability 3. CLR integration 4. Scalability Answer: 3. CLR integration Ver. 1.0 Session 1 Slide 10 of 35
  • 11. Querying and Managing Data Using SQL Server 2005 Identifying SQL Server 2005 Tools SQL Server 2005 provides the following tools: SQL Server Management Studio SQL Server Business Intelligence Development Studio Database Engine Tuning Advisor SQL Server Configuration Manager Ver. 1.0 Session 1 Slide 11 of 35
  • 12. Querying and Managing Data Using SQL Server 2005 Just a minute Which of the following tools of SQL Server 2005 allow starting and stopping the full-text search? 1. SQL Server Management Studio 2. Business Intelligence Development Studio 3. Database Engine Tuning Advisor 4. SQL Server Configuration Manager Answer: 4. SQL Server Configuration Manager Ver. 1.0 Session 1 Slide 12 of 35
  • 13. Querying and Managing Data Using SQL Server 2005 Identifying Data Types Data types: Specify the type of data that an object can contain Commonly used by SQL Server are: int float char varchar Ver. 1.0 Session 1 Slide 13 of 35
  • 14. Querying and Managing Data Using SQL Server 2005 Retrieving Specific Attributes Specific attributes can be retrieved by specifying selected column names in the SELECT statement. Syntax: SELECT [ALL | DISTINCT] select_column_list [INTO [new_table_name]] FROM {table_name | view_name} [WHERE search_condition] [GROUP BY group_by_expression] [HAVING search_condition] [ORDER BY order_expression [ASC | DESC]] [COMPUTE {{ AVG | COUNT | MAX | MIN | SUM } ( expression ) } [,...n ] [ BY expression [ ,...n ] ] Let’s see how… Ver. 1.0 Session 1 Slide 14 of 35
  • 15. Querying and Managing Data Using SQL Server 2005 Retrieving Specific Attributes (Contd.) Display of the result set can be customized using: User-defined headings Literals Concatenation operators Let’s see how… Ver. 1.0 Session 1 Slide 15 of 35
  • 16. Querying and Managing Data Using SQL Server 2005 Retrieving Specific Attributes (Contd.) Column values can be calculated using arithmetic operators: + (for addition) - (for subtraction) / (for division) * (for multiplication) % (for modulo) Let’s see how… Ver. 1.0 Session 1 Slide 16 of 35
  • 17. Querying and Managing Data Using SQL Server 2005 Retrieving Selected Rows Selected rows can be retrieved using the WHERE clause in the SELECT statement. Let’s see how… Ver. 1.0 Session 1 Slide 17 of 35
  • 18. Querying and Managing Data Using SQL Server 2005 Retrieving Selected Rows (Contd.) Comparison operators: Can be used with WHERE clause to create conditions Supported by SQL Server are: • = (equal to) • > (greater than) • < (less than) and many more Syntax: SELECT column_list FROM table_name WHERE expression1 comparison_operator expression2 Let’s see how… Ver. 1.0 Session 1 Slide 18 of 35
  • 19. Querying and Managing Data Using SQL Server 2005 Retrieving Selected Rows (Contd.) Logical operators: Can be used with SELECT statement to retrieve records based on one or more matching conditions Supported by SQL Server are: • AND • OR • NOT Syntax: SELECT column_list FROM table_name WHERE conditional_expression1 {AND/OR} [NOT] conditional_expression2 Let’s see how… Ver. 1.0 Session 1 Slide 19 of 35
  • 20. Querying and Managing Data Using SQL Server 2005 Retrieving Selected Rows (Contd.) Range operators: Can be used with SELECT statement to retrieve records based on a range Supported by SQL Server are: • BETWEEN • NOT BETWEEN Syntax: SELECT column_list FROM table_name WHERE expression1 range_operator expression2 AND expression3 Let’s see how… Ver. 1.0 Session 1 Slide 20 of 35
  • 21. Querying and Managing Data Using SQL Server 2005 Just a minute Which of the following are logical operators? 1. BETWEEN and NOT BETWEEN 2. AND, OR, and NOT 3. + and % 4. > and < Answer: 2. AND, OR, and NOT Ver. 1.0 Session 1 Slide 21 of 35
  • 22. Querying and Managing Data Using SQL Server 2005 Retrieving Selected Rows (Contd.) IN keyword: Allows the selection of values that match any one of the values in a list NOT IN keyword: Restricts the selection of values that match any one of the values in a list Syntax: SELECT column_list FROM table_name WHERE expression list_operator (‘value_list’) Let’s see how… Ver. 1.0 Session 1 Slide 22 of 35
  • 23. Querying and Managing Data Using SQL Server 2005 Retrieving Selected Rows (Contd.) LIKE keyword: Can be used to search for character string, date, or time values that match a specified pattern Uses wildcard characters like *, % to perform pattern match Let’s see how… • NULL values: Can be retrieved by using IS NULL keyword with SELECT statement Syntax: SELECT column_list FROM table_name WHERE column_name unknown_value_operator Let’s see how… Ver. 1.0 Session 1 Slide 23 of 35
  • 24. Querying and Managing Data Using SQL Server 2005 Retrieving Selected Rows (Contd.) ORDER BY clause: Can be used with the SELECT statement to display records in a specific order Displays record in ascending or in descending order Syntax: SELECT select_list FROM table_name [ORDER BY order_by_expression [ASC|DESC] [, order_by_expression [ASC|DESC]…] Let’s see how… Ver. 1.0 Session 1 Slide 24 of 35
  • 25. Querying and Managing Data Using SQL Server 2005 Retrieving Selected Rows (Contd.) TOP keyword: Can be used with the SELECT statement to retrieve only the first set of rows, which can be either a number or a percent of rows Syntax: SELECT [TOP n [PERCENT]] column_name [,column_name…] FROM table_name WHERE search_conditions [ORDER BY [column_name[,column_name…] Let’s see how… Ver. 1.0 Session 1 Slide 25 of 35
  • 26. Querying and Managing Data Using SQL Server 2005 Retrieving Selected Rows (Contd.) DISTINCT keyword: Can be used with the SELECT statement to eliminate duplicate rows Syntax: SELECT [ALL|DISTINCT] column_names FROM table_name WHERE search_condition Let’s see how… Ver. 1.0 Session 1 Slide 26 of 35
  • 27. Querying and Managing Data Using SQL Server 2005 Just a minute Write a query to display all the records of the ProductModel table where the product name begins with HL. Answer: SELECT * FROM Production.ProductModel WHERE Name LIKE 'HL%' Ver. 1.0 Session 1 Slide 27 of 35
  • 28. Querying and Managing Data Using SQL Server 2005 Demo: Retrieving Data Problem Statement: You are a database developer of AdventureWorks, Inc. The AdventureWorks database is stored on the SQLSERVER01 database server. The details of the sales persons are stored in the SalesPerson table. The management wants to view the details of the top three sales persons who have earned a bonus between $4,000 and $6,000. How will you generate this report? Ver. 1.0 Session 1 Slide 28 of 35
  • 29. Querying and Managing Data Using SQL Server 2005 Demo: Retrieving Data (Contd.) Solution: To solve the preceding problem, you need to perform the following tasks: 1. Create a query. 2. Execute the query to generate the report. Ver. 1.0 Session 1 Slide 29 of 35
  • 30. Querying and Managing Data Using SQL Server 2005 Summary In this session, you learned that: A business application can have three elements: user interface, business logic, and data storage. A database server is used to store and manage database in a business application. SQL Server 2005 consists of the following four core components: database engine, integration services, analysis services, and reporting services. The database engine provides support to store, query, process, and secure data on the database server. Integration services allow you to gather and integrate data from disparate data sources at a common location in a consistent format. Ver. 1.0 Session 1 Slide 30 of 35
  • 31. Querying and Managing Data Using SQL Server 2005 Summary (Contd.) Analysis services provide data mining solutions that help in data analysis. Reporting services provide support to generate comprehensive reports on the data stored in the database engine or the data warehouse. Microsoft SQL Server 2005 is integrated with the .NET Framework. The .NET Framework is an environment used to build, deploy, and run business applications through various programming languages. The .NET Framework consists of three components: development tools and languages, base class library, and CLR. Ver. 1.0 Session 1 Slide 31 of 35
  • 32. Querying and Managing Data Using SQL Server 2005 Summary (Contd.) SQL Server 2005 provides the following benefits: • Built-in support for XML • CLR integration • Scalability • Service-oriented architecture • Support for Web services • High level of security • High availability • Support for data migration and analysis SQL includes: • DDL: To create and manage database objects • DML: To store and manage data in database objects • DCL: To allow or deny access to database objects • DQL: To query data from the database objects Ver. 1.0 Session 1 Slide 32 of 35
  • 33. Querying and Managing Data Using SQL Server 2005 Summary (Contd.) SQL Server 2005 provides the following tools to improve the efficiency of the database developers and manage the server: • SQL Server Management Studio • SQL Server Business Intelligence Management Studio • Database Engine Tuning Advisor • SQL Server Configuration Manager Data can be retrieved from a database by using the SELECT statement. Data of all the columns of a table can be retrieved by specifying * in the select query. Data that has to be retrieved based on a condition is specified by adding the WHERE clause. Literals and user-defined headings are added to change the display. The concatenation operator is used to concatenate a string expression. Ver. 1.0 Session 1 Slide 33 of 35
  • 34. Querying and Managing Data Using SQL Server 2005 Summary (Contd.) – Arithmetic operators are used to perform mathematical operations. – Comparison operators test the similarity between two expressions. – Logical operators are used in the SELECT statement to retrieve records based on one or matching conditions. The logical operators are AND, OR, and NOT. – The Range operator retrieves data based on the range. There are of two types of range operators, BETWEEN and NOT BETWEEN. – The IN keyword allows the selection of values that match any one of the values in a list. – The NOT IN keyword restricts the selection of values that match any one of the values in a list. Ver. 1.0 Session 1 Slide 34 of 35
  • 35. Querying and Managing Data Using SQL Server 2005 Summary (Contd.) The LIKE keyword is used to specify the pattern search. The IS NULL keyword is used to retrieve missing values. The ORDER BY clause is used to retrieve data in a specific order. The TOP keyword retrieves only the first set of rows, which can either be a number or a percent of rows that will be returned from a query result. The DISTINCT keyword eliminates duplicate rows. Ver. 1.0 Session 1 Slide 35 of 35

Editor's Notes

  1. This session covers chapter 1 and first section 1 of chapter 2 of the Student Guide.
  2. Explain the components of SQL Server as follows: Database Engine: Provides support to store, query, process, and secure data on the database server Integration Services: Allow you to gather and integrate data from various disparate data sources available in an organization Analysis Services: Help in data analysis in a business intelligence application Reporting Services: Provide support to generate comprehensive reports on data in database engine or in data warehouse
  3. Emphasize on the fact that most DBMS have created customized versions of the SQL language. For example, Transact-SQL (T-SQL) is a scripting language used on the SQL Server for programming. Alternatively, PL-SQL is used for programming in Oracle. T-SQL confirms to the ANSI SQL-92 standard published by ANSI and ISO in the year 1992.
  4. When teaching this topic, only introduce the tools and tell the students about the utility of each tool. You can describe the different components of the SQL Server Management Studio while giving the first demonstration of Chapter 2. After this chapter, you need to teach the first section of Chapter 2 in the same session.
  5. NOTE: All the chapters in this book include SQL queries and demos to explain concepts. You need to demonstrate these queries using the user account, Kim, Robert, or Angela, who does not have administrative privileges. In the examples, where you need to use administrative rights, specific inputs have been given for the faculty. Explain the students that SQL Server 2005 consists of many data types. Int, float, char, and varchar are some of the most commonly used data types. In addition, explain all the four data types to the students and ask them to read in the SG about other data types. FAQs Question: Difference between char and varchar? Answer: Char has a fixed length of characters to store whereas it is flexible in case of varchar.
  6. NOTE: All the chapters in this book include SQL queries and demos to explain concepts. You need to demonstrate these queries using the user account, Kim, Robert, or Angela, who does not have administrative privileges. In the examples, where you need to use administrative rights, specific inputs have been given for the faculty. Explain the students that SQL Server 2005 consists of many data types. Int, float, char, and varchar are some of the most commonly used data types. In addition, explain all the four data types to the students and ask them to read in the SG about other data types. FAQs Question: Difference between char and varchar? Answer: Char has a fixed length of characters to store whereas it is flexible in case of varchar.
  7. Explain the students that while querying the data from the database, you need to modify the heading of the columns, add more values to the output, or merge the output of various columns to improve the readability. Execute the following queries to explain the concept: User-defined headings: 1. SELECT &apos;Department Number&apos;= DepartmentID, &apos; Department Name&apos;= Name FROM HumanResources.Department 2. SELECT DepartmentID &apos;Department Number&apos;, Name &apos; Department Name&apos; FROM HumanResources.Department 3. SELECT DepartmentID as &apos;Department Number&apos;, Name as &apos; Department Name&apos; FROM HumanResources.Department Literals: SELECT EmployeeID, &apos;Designation: &apos;, Title FROM HumanResources.Employee Concatenation Operators: SELECT Name + &apos; department comes under &apos; + GroupName + &apos; group&apos; AS Department FROM HumanResources.Department
  8. Explain the students that arithmetic operators are used to perform mathematical operations, such as addition, subtraction, division, and multiplication, on numeric columns or on numeric constants. Additional Inputs Operator precedence levels are as follows: for arithmetic operators, the precedence is ‘*’, ‘/’, ‘,’, ‘%’, ‘-’, ‘+’. The precedence levels can be changed by the use of ‘( )’. Example SELECT EmployeeID, Rate, Per_Day_Rate = 8 * Rate FROM HumanResources.EmployeePayHistory
  9. Explain the students that similar to retrieving the selected columns you can also retrieve selected rows from the table using WHERE clause. Stress on writing the SQL statement in separate lines in the Query Pane of Microsoft SQL Server Management Studio. It becomes easy to read and debug. Example: SELECT * FROM HumanResources.Department WHERE GroupName = &apos;Research and Development&apos;
  10. Explain the students that you can use any of the three comparison operators with WHERE clause to create conditions. Example: SELECT EmployeeID, NationalIDNumber, Title, VacationHours FROM HumanResources.Employee WHERE VacationHours &gt; 20
  11. Explain the students that multiple conditions can be used to retrieve data from a table, and you can do this by using the logical operators. Example: (OR) SELECT * FROM HumanResources.Department WHERE GroupName = &apos;Manufacturing&apos; OR GroupName = &apos;Quality Assurance&apos; Example: (AND) SELECT * FROM HumanResources.Employee WHERE Title = &apos;Production Technician - WC60&apos; AND MaritalStatus = &apos;M‘ Example: (NOT) SELECT * FROM HumanResources.Department WHERE GroupName = &apos;Manufacturing&apos; OR NOT GroupName = &apos;Quality Assurance&apos;
  12. Explain the students that you can use range operators to retrieve selected rows which falls within a particular range. Example: (Between) SELECT EmployeeID, VacationHours from HumanResources.Employee WHERE VacationHours BETWEEN 20 AND 50 Example: (Not Between) SELECT EmployeeID,VacationHours FROM HumanResources.Employee WHERE VacationHours NOT BETWEEN 40 AND 50
  13. Example: (IN) SELECT EmployeeID,Title, LoginID FROM HumanResources.Employee WHERE Title IN (&apos;Recruiter&apos;, &apos;Stocker&apos;) Example: (NOT IN) SELECT EmployeeID,Title, LoginID FROM HumanResources.Employee WHERE Title NOT IN (&apos;Recruiter&apos;, &apos;Stocker&apos;)
  14. Wildcard Characters Mention that if a particular character pattern is being searched for, the wildcard characters can be used along with the LIKE keyword. Additional Input A wildcard is a special character such that you can use to represent one or more characters. Any character or set of characters can replace a pattern matching character. Example: (Using %) SELECT * FROM HumanResources.Department WHERE Name LIKE &apos;Pro%‘ Example: (Using _) SELECT * FROM HumanResources.Department WHERE Name LIKE &apos;Sale_‘ Mention that IS NULL or NOT NULL are unknown value operators.
  15. Explain the students that when the ORDER BY clause is used, only the output of the SELECT statement is sorted. Stress on that the physical data in the table remains as it is, only the output is sorted. In addition, mention that the default sort order is ASC. Additional Inputs Image, text, and ntext columns cannot be used in an ORDER BY clause. Example: (ASC) SELECT DepartmentID, Name FROM HumanResources.Department ORDER BY Name ASC
  16. Stress that the TOP keyword is used to retrieve the top few records, as they exist in the table. If you require the top few records with respect to a sort order of a particular column, then you need to include the ORDER BY keywords in the SELECT statement. Additional Input Unlike previous versions of Microsoft SQL Server, now TOP keyword can also be used with DML statements, such as UPDATE or DELETE. Example: SELECT TOP 3 * FROM HumanResources.Employee WHERE HireDate &gt;= &apos;1/1/98&apos; AND HireDate &lt;= &apos;12/31/98&apos; ORDER BY SickLeaveHours ASC
  17. Explain the students that when you use more than one column with the DISTINT clause, SQL Server displays you the unique matches of these columns. Additional Inputs When using DISTINCT, only the name of a column can be used, an arithmetic expression gives an error. Example: SELECT DISTINCT Title FROM HumanResources.Employee WHERE Title LIKE &apos;PR%&apos;
  18. Explain the students that in such cases, we can not use the normal WHERE clause.
  19. At the end of this demo, the student will learn how to retrieve data from a table. Pre requisites for the demo: To perform the demos of the book, you need to use any of the users, Angela, Robert, or Kim, created at the time of installation.
  20. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  21. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  22. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  23. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.