Pular para o conteúdo

Onde está o erro ?? [RESOLVIDO]

Responder tópico
  • Denunciar
  • Indicar

1. Onde está o erro ?? [RESOLVIDO]

Enviado em 17/09/2019 - 22:17h

Pessoas, estou me aventurando com mariadb e estou com erro na 1ª criação, onde estou errando ???

MariaDB [db_biblioteca]> CREATE TABLES tbl_livro( id_livro smallint AUTO_INCREMENT PRIMARY_KEY, nome_livro Varchar(50) NOT NULL, ISBN Varchar(30) NOT NULL, id_autor smallint NOT NULL, data_pub DATE NOT NULL, preco_livro decimal NOT NULL);


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TABLES tbl_livro( id_livro smallint AUTO_INCREMENT PRIMARY_KEY, nome_livro Varch' at line 1

Responder tópico

2. Re: Onde está o erro ??

Melhor resposta

Enviado em 19/09/2019 - 12:35h

Ola,

o comando é CREATE TABLE e não CREATE TABLES.

você deve estar confundindo com o comando SHOW TABLES...

3. Re: Onde está o erro ??

Enviado em 19/09/2019 - 14:48h

Mauriciodez escreveu:

Pessoas, estou me aventurando com mariadb e estou com erro na 1ª criação, onde estou errando ???

MariaDB [db_biblioteca]> CREATE TABLES tbl_livro( id_livro smallint AUTO_INCREMENT PRIMARY_KEY, nome_livro Varchar(50) NOT NULL, ISBN Varchar(30) NOT NULL, id_autor smallint NOT NULL, data_pub DATE NOT NULL, preco_livro decimal NOT NULL);


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TABLES tbl_livro( id_livro smallint AUTO_INCREMENT PRIMARY_KEY, nome_livro Varch' at line 1

Boa tarde Mauricio.
Perguntar não ofende.....
Antes de criar a TABELA, você criou a base de dados (database)?
Veja os tutoriais abaixo:
https://thobias.org/doc/shell_bd.html
https://www.tutorialspoint.com/mariadb/index.htm

Importante => echo -e "$(lynx --dump goo.gl/a9KeFc|sed -nr '/^[ ]+Se/,/dou.$/p')"
Att.: Marcelo Oliver

4. Re: Onde está o erro ??

Enviado em 19/09/2019 - 21:46h

StanislausK escreveu:
Ola,
o comando é CREATE TABLE e não CREATE TABLES.
...


ok ... é erro de iniciante mesmo, agora tenho outro erro de sintaxe, é meio complicado onde achar o erro exatamente, mas creio que seja logo no inicio . só não sei onde

MariaDB [db_biblioteca]> CREATE TABLE tbl_livro(id_livro smallint AUTO_INCREMENT PRIMARY_KEY, nome_livro Varchar(50) NOT NULL, ISBN Varchar(30) NOT NULL, id_autor smallint NOT NULL, data_pub DATE NOT NULL, preco_livro decimal NOT NULL);

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' nome_livro Varchar(50) NOT NULL, ISBN Varchar(30) NOT NULL, id_autor smallint N' at line 1

MariaDB [db_biblioteca]>


EDIT: Achei o erro aqui >> PRIMARY_KEY .... PRIMARY KEY

Obrigado pessoas !!!

------------------------------------------------------| Linux User #621728 |------------------------------------------------------

" Nem sempre é amigo aquele que te tira do buraco !!! ( Saddam Hussein )"

------------------------------------------------------| Linux User #621728 |------------------------------------------------------


Responder tópico

Responder tópico

Entre na sua conta para responder.

Fazer login para responder