Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 588
user295515 Avatar asked May 01 '10 12:05

user295515


People also ask

How do I create a SQL table from another database?

The easiest way is by right click on table A from database temp , then click Script Table as => CREATE to => New Query Editor Window . This will create the script. Then, change following 2 lines. and run it for new database.

What are the two ways to CREATE TABLE in database?

Creating Tables in a Database There are several ways to create a new table: in Datasheet view, in Design view, with Table Templates, SharePoint Lists, or by importing a table or linking to the data in a table from another Access database.


1 Answers

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, .... )

like image 127
Dmitry Yudakov Avatar answered Oct 04 '22 19:10

Dmitry Yudakov