Jump to content

erro mysql ajuda!


elementsky
 Share

Recommended Posts

 CREATE TABLE `clientes` (
`Nome` VARCHAR( 4 ) UNSIGNED NOT NULL ,
`Morada` VARCHAR( 6 ) UNSIGNED NOT NULL ,
`Telefone` VARCHAR( 7 ) UNSIGNED NOT NULL ,
`Nº Contribuinte` VARCHAR( 15 ) UNSIGNED NOT NULL ,
`E-mail` VARCHAR( 6 ) UNSIGNED NOT NULL
) 

O que é que está mal aqui.

P.S. é a minha primeira tentativa de bd em mysql

Link to comment
Share on other sites

o que te esta a dar erro é o facto de nao teres um ponto e virgula no fim

em sql as instruções sao dadas por um ponto e virgula... assim sendo...

CREATE TABLE `clientes` (
`Nome` VARCHAR( 4 ) UNSIGNED NOT NULL ,
`Morada` VARCHAR( 6 ) UNSIGNED NOT NULL ,
`Telefone` VARCHAR( 7 ) UNSIGNED NOT NULL ,
`Nº Contribuinte` VARCHAR( 15 ) UNSIGNED NOT NULL ,
`E-mail` VARCHAR( 6 ) UNSIGNED NOT NULL
) ;
Link to comment
Share on other sites

Nomes de campos e de tabelas (e seja do que for) não podem ter caracteres especiais, pontuação e espaços.

Uma tabela não requer chaves (primarias ou estrangeiras) indices ou seja que propriedade adicional for.

Procura por DDL(data definition language) para saberes mais sobre a criação de tabelas, triggers, stored procedures e afins (standard sql).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.