Read the input string and break each sentence into groups of 5 words. A row may
contain more than one sentence. Each sentence in the input should start a new group.
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 comment
-- ---------------------------------------------------------------------
1 The upcoming release of SQL Server is codenamed Denali. It is
also called SQL11 which refers to version 11 and people misunderstand
it to be SQL Server 2011.
2 SQL Server Denali CTP 3 introduced a number of TSQL enhancements.
Expected Results
id sentence group text
-- -------- ----- -----------------------------------
1 1 1 The upcoming release of SQL
1 1 2 Server is codenamed Denali
1 2 1 It is also called SQL11
1 2 2 which refers to version 11
1 2 3 and people misunderstand it to
1 2 4 be SQL Server 2011
2 1 1 SQL Server Denali CTP 3
2 1 2 introduced a number of TSQL
2 1 3 enhancements
Rules
- The expected results should be ordered by id, sentence, group.
- The rows in Sample Data is broken into multiple lines for display purpose only.
Sample Script
Use the TSQL Script given below to generate the source table and fill them with sample data.
IF OBJECT_ID('TC62','U') IS NOT NULL BEGIN
DROP TABLE TC62
END
GO
CREATE TABLE TC62(
id INT IDENTITY,
comment VARCHAR(MAX)
)
GO
INSERT INTO TC62(comment)
SELECT 'The upcoming release of SQL Server is codenamed Denali. It is also called SQL11 which refers to version 11 and people misunderstand it to be SQL Server 2011.' UNION ALL
SELECT 'SQL Server Denali CTP 3 introduced a number of TSQL enhancements.'
SELECT * FROM TC62
Restrictions
- The solution should be a single query that starts with a "SELECT" or “;WITH”
Notes
- Read the Submission Guidelines and make sure that your solution follows them.
- 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..