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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Creating a schema using the MySQL Workbench UI2m 54s
-
(Locked)
Creating a schema using SQL code4m 27s
-
(Locked)
Creating a table using the MySQL Workbench UI6m 52s
-
(Locked)
Creating a table using SQL code6m 3s
-
(Locked)
MySQL data types5m 40s
-
(Locked)
Challenge: Creating your own schema and tables2m 28s
-
(Locked)
Solution: Creating your own schema and tables12m 1s
-
(Locked)
Adding and removing columns using the MySQL Workbench UI13m 39s
-
(Locked)
Adding and removing columns with SQL code5m 4s
-
(Locked)
Challenge: Adding and removing columns1m 25s
-
(Locked)
Solution: Adding and removing columns6m 59s
-
(Locked)
Dropping schemas and tables6m 45s
-
(Locked)
Challenge: Dropping schemas and tables1m 46s
-
(Locked)
Solution: Dropping schemas and tables2m 22s
-
(Locked)
-
-
-
-
-
-