Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

erro para criar tabela aula 3

Error: ER_PARSE_ERROR: 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 'in NOT NULL AUTO_INCREMENT, cliente varchar(50) NOT NULL, pet varchar(20), s...' at line 1 at Query.Sequence.packetToError (C:\Users\lekao\OneDrive\Documents\node\nodemodules\mysql\lib\protocol\sequences\Sequence.js:47:14) at Query.ErrorPacket (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\protocol\sequences\Query.js:79:18) at Protocol.parsePacket (C:\Users\lekao\OneDrive\Documents\node\nodemodules\mysql\lib\protocol\Protocol.js:291:23) at Parser.parsePacket (C:\Users\lekao\OneDrive\Documents\node\nodemodules\mysql\lib\protocol\Parser.js:433:10) at Parser.write (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\protocol\Parser.js:43:10) at Protocol.write (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\protocol\Protocol.js:38:16) at Socket. (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\Connection.js:88:28) at Socket. (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\Connection.js:526:10) at Socket.emit (events.js:315:20)

at addChunk (internal/streams/readable.js:309:12)
--------------------
at Protocol._enqueue (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Connection.query (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\Connection.js:198:25)
at Tabelas.criarAtendimento (C:\Users\lekao\OneDrive\Documents\node\infra\tabelas.js:10:22)
at Tabelas.init (C:\Users\lekao\OneDrive\Documents\node\infra\tabelas.js:5:14)
at Handshake.<anonymous> (C:\Users\lekao\OneDrive\Documents\node\index.js:10:17)
at Handshake.<anonymous> (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\Connection.js:526:10)
at Handshake._callback (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\Connection.js:488:16)
at Handshake.Sequence.end (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\protocol\sequences\Sequence.js:83:24)
at Handshake.Sequence.OkPacket (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\protocol\sequences\Sequence.js:92:8)
at Protocol._parsePacket (C:\Users\lekao\OneDrive\Documents\node\node_modules\mysql\lib\protocol\Protocol.js:291:23) {

code: 'ER_PARSE_ERROR', errno: 1064, sqlMessage: "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 'in NOT NULL AUTO_INCREMENT, cliente varchar(50) NOT NULL, pet varchar(20), s...' at line 1", sqlState: '42000', index: 0, sql: 'CREATE TABLE Atendimentos (id in NOT NULL AUTO_INCREMENT, cliente varchar(50) NOT NULL, pet varchar(20), servico varchar(20) NOT NULL, status varchar(20) NOT NULL, observacoes text PRIMARY KEY(id))' }

2 respostas
solução!

Pelo que entendi, você tem um erro de sintaxe de SQL.

CREATE TABLE Atendimentos (
    id in NOT NULL AUTO_INCREMENT, 
    cliente varchar(50) NOT NULL, 
    pet varchar(20), 
    servico varchar(20) NOT NULL, 
    status varchar(20) NOT NULL, 
    observacoes text
    PRIMARY KEY(id)
)

No lugar daquele in não seria int e adicionar uma virgula depois do ultimo campo?

CREATE TABLE Atendimentos (
    id int NOT NULL AUTO_INCREMENT, 
    cliente varchar(50) NOT NULL, 
    pet varchar(20), 
    servico varchar(20) NOT NULL, 
    status varchar(20) NOT NULL, 
    observacoes text,
    PRIMARY KEY(id)
)

Eu tinha apagado tudo, vou tentar refazer aqui pode ser isso ai vlw, obrigado.

Eu tinha copoiado e colado o codigo que estava na transcrição da aula la estava assim errado

vlw funcionou