From the course: Linux System Engineer: Database Servers Using MariaDB

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Subcommands to manage tables

Subcommands to manage tables

From the course: Linux System Engineer: Database Servers Using MariaDB

Start my 1-month free trial

Subcommands to manage tables

- [Instructor] Using the MySQL Shell, we can create and delete tables as well as databases. To create a table inside the MySQL Shell, we use the CREATE subcommand again but specify table. By default, the table is created in the default database using the InnoDB storage engine. You will get an error message if the table exists or there is no default database. We can also switch to a different database using the USE subcommand first. To do so, we type in USE followed by the database name. Now that we've changed databases, we could use the CREATE subcommand to create a new table. We'll also need to specify the table name to create it. When creating a table, we may also want to include IF NOT EXISTS to keep from getting an error if the table already exists. There are many options to the CREATE TABLE subcommand including the table name, specifying temporary tables, cloning or copying tables, column data types, column attributes, indexes, foreign keys, table options and partition tables. As…

Contents