A database server can host many databases. Common commands (MySQL syntax):
CREATE DATABASE shop;: create a database.
SHOW DATABASES;: list databases.
USE shop;: select the database to work in.
DROP DATABASE shop;: delete it and all its data.
BACKUP / mysqldump shop > shop.sql: back up a database.
SQLite, used in this editor, stores a whole database in a single file, so it has no CREATE DATABASE command. The example lists the tables in the current database instead.
💡 Key Takeaways: SQL CREATE DATABASE
Mastering SQL CREATE DATABASE helps you write clean and reliable SQL code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
SQL CREATE DATABASE Code Example
SQL
-- In MySQL you would write:
-- CREATE DATABASE shop;
-- USE shop;
-- In SQLite, list the tables of the current database:
SELECT name AS TableName FROM sqlite_master WHERE type = 'table';
Free sign-in required · Google login available
SQL CREATE DATABASE Practice Exercises
Check what you learned in “SQL CREATE DATABASE”.
/ 3 solved
Fill in the blank
Create a database named shop (MySQL).
shop;
✓ Correct!Not quite. Try again.
Multiple choice
Which statement deletes a database and all its data?
✓ Correct!Not quite. Try again.
Code challenge
List the names of all tables in the sample database (sqlite_master, type = 'table'), sorted by name.
Write the code in the live editor. Your answer is checked automatically.