Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

This challenge involves counting the number of occurrences of HTML tags in a given list of strings. You can assume that there will be only valid HTML tags in the input strings. The output should display tags in ascending order.

TSQL Beginners Challenge 18 - Count the total occurrences of HTML tags in the given string

TSQL Beginners Challenge 18 - Count the total occurrences of HTML tags in the given string

Oct 11 2010 6:50AM by Niladri Biswas   

Introduction

This challenge involves counting the number of occurrences of HTML tags in a given list of strings. You can assume that there will be only valid HTML tags in the input strings. The output should display tags in ascending order.

Sample Data

ID  HtmlText
--	------------------------------------------------------------------------
1   <Html><Body><Font>This is challenge #18</Font><Font></Font></Body></Html>

Expected Results

ID TagNamesOccurance 
-- --------------------------------------------------------------
1  Body(Found: 1 time), Font(Found: 2 times), Html(Found: 1 time)

Rules

  1. ID should be sorted in ascending order.
  2. The program should run in SQL SERVER 2005 and above.
  3. The output should be in the same way as it has been shown. Column names should be exactly the same and the result must be sorted in Ascending order of ID.

Sample Script

Use the following script to generate the sample data.

DECLARE @t TABLE(ID INT IDENTITY, HtmlText VARCHAR(Max))
INSERT INTO @t(HtmlText)
SELECT '<Html><Body><Font>This is challenge #18</Font><Font></Font></Body></Html>'

SELECT * FROM @t

Restrictions

  1. The solution should be a single query that starts with a "SELECT" or “;WITH”.

Notes

Tags:Puzzles, TSQL Beginners Challenge, TC, TSQL Beginners Challenge 18

Niladri Biswas
7 · 21% · 6710
TSQL Beginners Challenge 18 - Count the total occurrences of HTML tags in the given string , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]