Mysql help PhpMyAdmin How to insert a table into a bank?

0

How do I insert a table into a table? I am a beginner mysql user and a beginner in the programming world.

I made the following code:

INSERT INTO banco1(

CREATE TABLE Cliente (
    id INT NOT NULL AUTO_INCREMENT
    nome varchar(60)NOT NULL DEFAULT vazio, 
    sexo ENUM('M','F'),
    data_de_nascimento date,
    limite_de_credito decimal(9,2),
    cidade varchar(50),
    bairro varchar(50)
    PRIMARY KEY(id), 
    INDEX(nome) ))
    ENGINE=INNODB   Charset= utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT;
  

I get the following ERROR:

Error Static analysis: 2 errors were found during analysis.

Palavra-chave inesperada. (near "ENGINE" at position 311)
Unrecognized statement type. (near "ENGINE" at position 311)

Comando SQL: 
INSERT INTO banco1( CREATE TABLE Cliente ( id INT NOT NULL AUTO_INCREMENT nome varchar(60)NOT NULL DEFAULT vazio, sexo ENUM('M','F'), data_de_nascimento date, limite_de_credito decimal(9,2), cidade varchar(50), bairro varchar(50) PRIMARY KEY(id), INDEX(nome) )) ENGINE=INNODB Charset= utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT 
Mensagens do MySQL :  
#1046 - Nenhum banco de dados foi selecionado
    
asked by anonymous 29.08.2018 / 19:45

1 answer

0

The INSERT is used to insert data into tables, not tables into banks. If you want to use a certain bank, use the USE command.

Instead of:

    INSERT INTO banco1 ... ;

Switch By:

    USE banco1; 
    CREATE TABLE ... ;
    
29.08.2018 / 21:07