Codewars SQL

SQL Intermediate: Add index column to a query

Return a new table from people table.

Your solution should have a row index number with the column name row number, id and the name of every people alphabetically.

This code can be used to normalize in REAL enviroments when you don’t have an id column and should generate it from scratch.

HINT: try to use ANSI SQL only. HINT: you can add generated indexes attaching to the first query, but is more elegant to retrieve them at the same query.

Tested with SQLite 3.2.8 but should work with MySQL, and SQL server.

Your solution generally will not work with PostgreSQL.





Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store