MySQL DatabaseLesson 59Free preview
MySQL Create DB
This lesson is part of PHP · All levels
Summary
The new database was created using the SQL CREATE DATABASE command that runs through mysqli_query(). The addition of IF NOT EXISTS makes the command safe to run repeatedly without triggering an error. Once the database is created, you have to select it as an active database before you create a table.
Key points
- Create a new database name.
- If NOT EXISTS makes the command idempotent so it's safe to run repeatedly.
- SHOW DATABASES displays a list of databases that are available on the server.
- Once created, select the database with USE or mysqli_select_db().
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.