From the course: MySQL Database Administration

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Creating a schema using SQL code

Creating a schema using SQL code - MySQL Tutorial

From the course: MySQL Database Administration

Creating a schema using SQL code

- [Instructor] In addition to using Workbench's UI to create new schemas, we can also create new schemas using a simple SQL create statement. When we use SQL code to do this, we can choose the same options for our schema that we chose when we used the UI. And again, whether we choose to create the schemas using the UI or using SQL queries, it's just a matter of preference. They're both going to do the same thing. So let's jump into Workbench and walk through an example. So here we have Workbench, the editor open, and we can say, CREATE SCHEMA myfirstcodeschema. And this query is all you need to create a new schema. I'm going to go ahead and run it. And so now when I refresh here, we see another schema here. Again, it doesn't have anything in it. There's no tables, no views, but the schema itself does exist. So if we wanted to populate that with other objects, tables, views, procedures and functions, we could do that. But right now, it's empty. And let me show you another example. I'll…

Contents