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


Upload Image Close it
Select File

This challenge aims to test your string parsing and summarizing skills using TSQL. The challenge is to count the number of mobile phones each person has and generate a summary row.

TSQL Beginners Challenge 6 - Count the number of mobile phones and generate a summary

TSQL Beginners Challenge 6 - Count the number of mobile phones and generate a summary

Apr 26 2010 2:24AM by Niladri Biswas   

Introduction

This challenge aims to test your string parsing and summarizing skills using TSQL. The challenge is to count the number of mobile phones each person has and generate a summary row.

Sample Data

PersonTable

PersonId PersonName
-------- ------------------
1	     Deepak Kumar Goyal
2	     Niladri Biswas

ContactDetail Table

PersonId MobileNumber
-------- ---------------------
1	     9886551234,9445612356
2	     9886334510

Expected Results

PersonId PersonName         MobileNumber           RecordCount
-------- ------------------	---------------------  -----------
1        Deepak Kumar Goyal 9886551234,9445612356  2
2        Niladri Biswas     9886334510             1
          Total Mobiles:                            3

Rules

  1. PersonId should be sorted in Ascending Order.
  2. If a person does not have any mobile, then his/her Record Count will be 0.
  3. If a person does not have any name (Blank or NULL assigned)or Mobile number, his/her record should not be counted.
  4. If a person does not have any name (Blank or NULL assigned) but is having Mobile Number, his/her record should not be counted.

Sample Script

Use the following script to generate the sample data

DECLARE @Person TABLE(PersonId INT,PersonName VARCHAR(20))
INSERT INTO @Person 
SELECT 1,'Deepak Kumar Goyal' UNION ALL
SELECT 2,'Niladri Biswas' 
SELECT * FROM @Person

DECLARE @ContactDetail TABLE(PersonId INT,MobileNumber VARCHAR(100))
INSERT INTO @ContactDetail
SELECT 1, '9886551234,9445612356' UNION ALL 	  
SELECT 2,'9886334510' 
SELECT * FROM @ContactDetail	    

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 6

Niladri Biswas
7 · 21% · 6720
TSQL Beginners Challenge 6 - Count the number of mobile phones and generate a summary , 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]