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 table using SQL code

Creating a table using SQL code - MySQL Tutorial

From the course: MySQL Database Administration

Creating a table using SQL code

- [Presenter] Alright, next, we're going to talk about how to create a data table using SQL code. So after the schema is created, just like with the UI, we're now able to populate our schema with tables and we can do that with SQL code here. When we create a new table with code that typically involves selecting the schema, we'll execute a used statement or we can also select it from the schemas tab. Then we'll give the new table a name. We'll specify which columns we want to include and which data formats and types there'll be. And we can also put on different constraints and different properties on the table. We can name a primary key, we can make some of the columns non-null. We can make some of the columns unique so we can put on various constraints, we can put on foreign keys. And again, we'll talk about all that stuff in more depth later. Just trying to give you an overview right now. So let's jump into workbench and I'll walk you through writing the SQL code to create a new…

Contents