In a company, several different programs insert rows into a messages table which should later be parsed and inserted into appropriate tables. Consider the tables:
TABLE messages id INTEGER NOT NULL PRIMARY KEY type VARCHAR(30) NOT NULL data VARCHAR(100) NOT NULL TABLE notifications id INTEGER NOT NULL PRIMARY KEY message VARCHAR(100) NOT NULL TABLE alerts id INTEGER NOT NULL PRIMARY KEY shortMessage VARCHAR(15) NOT NULL
Create a procedure called ParseMessages, in the default schema, which should do the following for all rows in the messages table:
- Insert all rows where the type is 'notification' to the notifications table with the message field being set to the data field of messages table.
- Insert all rows where the type is 'alert' to the alerts table with the shortMessage field being set to the first 15 characters of the data field of messages table.
In both cases the id field should be the same as in the messages field.
See the example case here for more details.
- Example case: Could not find stored procedure 'ParseMessages'.
- The messages table contains only notifications: Could not find stored procedure 'ParseMessages'.
- The messages table contains only alerts with less than 15 characters: Could not find stored procedure 'ParseMessages'.
- The messages table contains notifications and alerts longer than 15 characters: Wrong answer
Tags
MS SQL ServerWould you like to see our other questions?
We have 850+ premium hand-crafted questions for 50+ job skills and 15+ coding languages. We prefer questions with small samples of actual work over academic problems or brain teasers.
Visit our question libraryPrivate Concierge
Send us an email with an explanation of your testing needs and a list of candidates. We will create an appropriate test, invite your candidates, review their results, and send you a detailed report.
Contact Private ConciergeWould you like to see our tests? The following tests contain MS SQL Server related questions:
On the TestDome Blog
Screening Applicants: The Good, the Bad and the Ugly
Since we’re all biased and we use incorrect proxies, why not just outsource hiring to experts or recruitment agencies? After all, they’ve been screening people for many years, so they must know how to do it right?
Not really. I was surprised to discover that many experts disagree with each other. Everybody praises their pet method and criticizes the others. Many of these methods look legitimate, but are based on...