CoderPad lets you create custom database environments for MySQL and PostgreSQL. Click the ‘New Custom Database’ button, write a custom SQL script to upload your data and wait for your database to be verified.
The easiest way to get the raw SQL from an existing database in order to upload it to CoderPad is mysqldump for MySQL, or pg_dump for PostgreSQL. You can upload up to 5 MB of raw SQL.
After your database is initialized, when you create a new question and select MySQL or PostgreSQL as the language, an additional dropdown menu will allow you to attach your custom database to the question. When you load those questions into an interview, the database you attached will also be available for querying.
Click save, and you’ll see a notification that your database is initializing. This shouldn’t take longer than a minute or two. If you see an error message, it means your SQL is structured incorrectly. Please correct any errors and try again. Once the database is initialized, you’ll see the database schema (as below).
When you return to the databases tab, you’ll see all custom databases you’ve created:
In order to use a custom database in a CoderPad interview, you must attach it to an interview question. Then, when you load that question in an interview, it also loads the associated custom database.
Caution: loading our standard MySQL or PostgreSQL environments without also loading a specific database-related question will load our standard sample database, not your custom database.
Next, go to the Questions tab and “Write a New Question”. Choose MySQL or PostgreSQL from the language dropdown menu. An additional “Custom database” dropdown will appear. Select the custom database you’d like to use with this question, write your question or instructions, and save.
Now this question and its associated database will be available for use in any interview. In any pad, open the questions menu, search for MySQL or PostgreSQL questions, and select your question. Once you insert that question into the pad, your database will automatically be loaded and available for querying.