Getting Started with Adobe After Effects - Part 6: Motion Blur
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.

TSQL Challenge 67 - Find the longest sequence of alphabets in a string

This challenge invites you to identify the longest sequence of alphabets from a string.

Database Source Control in just 5 minutes
It takes just 5 minutes to connect your SQL databases to source control. Got 5 minutes to spare? Bring your database development process forward by 5 years. Get started now.

Sample Data

ID String
-- ---------------------------
 1 ASDFKIJKLMNAXDBABCIJKPPSRNK
 2 XYZABCPPCKLMIDB *)(3 xxABC
 3 ASDF;LKJQWERPOIUNMLKSTUVABC

Expected Results

ID Sequence
 -- -------
 1  IJKLMN
 2  ABC
 3  STUV

Rules

  1. The database has a case-insensitive collation.
  2. Only the 26 letters from A to Z are to be considered in a sequence.
  3. Input string can contain special characters.
  4. Input string will contain atleast 1 letter from A to Z.
  5. If more than one sequence having same number of characters is found, then the sequence that begins earlier in the English alphabet should get precedence.
  6. The output should be ordered by ID.

Sample Script

Use the TSQL Script given below to generate the source tables and fill them with sample data.

IF OBJECT_ID('TC67','U') IS NOT NULL BEGIN
	DROP TABLE TC67
END
GO

CREATE TABLE TC67(
	ID INT IDENTITY,
	String VARCHAR(4000)
)
GO

INSERT INTO TC67(String)
SELECT 'ASDFKIJKLMNAXDBABCIJKPPSRNK' UNION ALL
SELECT 'XYZABCPPCKLMIDB *)(3 xxABC' UNION ALL
SELECT 'ASDF;LKJQWERPOIUNMLKSTUVABC' 

SELECT * FROM TC67
GO

Restrictions

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

Notes

  1. Read the Submission Guidelines and make sure that your solution follows them.
  2. If you would like to use a Tally Table, you can use the script given here. Your solution should not include the script to create and populate the tally table. You can assume that the tally table will be available in the database where the evaluation team will run your Code.
Database Source Control in just 5 minutes
It takes just 5 minutes to connect your SQL databases to source control. Got 5 minutes to spare? Bring your database development process forward by 5 years. Get started now.

Jacob Sebastian
1 · 100% · 32235
Submit a Solution
Previous Challenge
Next Challenge
6
Liked
26
Comments
84
Solutions



Submit

TSQL Challenge 67 - Find the longest sequence of alphabets in a string

Managed Windows Shared Hosting by OrcsWeb

Copyright © Rivera Informatic Private Ltd.