Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL Print 1 to 9
00:00
5 left

SQL Print 1 to 9

EasySQL · PostgreSQL

Problem

Write a SQL query to print numbers from 1 to 9.

Use the numbers table and return only values in the requested range. Values outside the range and rows with a NULL number must be ignored.

Output

  1. One column named number
  2. Values from 1 through 9, one per row
  3. Results ordered in ascending numeric order

Schema

numbers
ColumnTypeDescription
number_idPKINTEGERUnique row identifier
numberINTEGERNumber available for output
Tablesnumbers
Interviewer

Your question is SQL Print 1 to 9. Start with the requirements and the one table in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.