How to create a table in a particular database?

The create database statement is:

CREATE TABLE table_name
(
    column_name1 data_type,
    column_name2 data_type,
    column_name3 data_type,
    ....
)

But I’m wondering how can I create a table in a specific database?

Answer

You can specify the DB Name in the same query:

CREATE TABLE database_name.table_name ( column_name1 data_type, column_name2 data_type, column_name3 data_type, .... )

Leave a Reply

Your email address will not be published. Required fields are marked *