Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Fabio Thomaz_160406

Problema para criar tabela

Recommended Posts

galera boa noite, é o seguinte estou iniciando a pouco tempo no php e estou tendo dificuldades para criar tabelas e colunas atualmente utilizo o mysql 5.5 e phpmyadmin, fiz o banco de dados e vou no console sql do phpmyadmin porem nao consigo fazer a tabela deve ser problema na sintase so que no manual do mysql esta bem confuso pra min nao entendi nada vejam:

 

CREATE [TEMPORARY] TABLE [iF NOT EXISTS] tbl_name

(create_definition,...)

[table_options]

[partition_options]

 

Or:

 

CREATE [TEMPORARY] TABLE [iF NOT EXISTS] tbl_name

[(create_definition,...)]

[table_options]

[partition_options]

select_statement

 

Or:

 

CREATE [TEMPORARY] TABLE [iF NOT EXISTS] tbl_name

{ LIKE old_tbl_name | (LIKE old_tbl_name) }

 

create_definition:

col_name column_definition

| [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)

[index_option] ...

| {INDEX|KEY} [index_name] [index_type] (index_col_name,...)

[index_option] ...

| [CONSTRAINT [symbol]] UNIQUE [iNDEX|KEY]

[index_name] [index_type] (index_col_name,...)

[index_option] ...

| {FULLTEXT|SPATIAL} [iNDEX|KEY] [index_name] (index_col_name,...)

[index_option] ...

| [CONSTRAINT [symbol]] FOREIGN KEY

[index_name] (index_col_name,...) reference_definition

| CHECK (expr)

 

column_definition:

data_type [NOT NULL | NULL] [DEFAULT default_value]

[AUTO_INCREMENT] [uNIQUE [KEY] | [PRIMARY] KEY]

[COMMENT 'string']

[COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}]

[sTORAGE {DISK|MEMORY|DEFAULT}]

[reference_definition]

 

data_type:

BIT[(length)]

| TINYINT[(length)] [uNSIGNED] [ZEROFILL]

| SMALLINT[(length)] [uNSIGNED] [ZEROFILL]

| MEDIUMINT[(length)] [uNSIGNED] [ZEROFILL]

| INT[(length)] [uNSIGNED] [ZEROFILL]

| INTEGER[(length)] [uNSIGNED] [ZEROFILL]

| BIGINT[(length)] [uNSIGNED] [ZEROFILL]

| REAL[(length,decimals)] [uNSIGNED] [ZEROFILL]

| DOUBLE[(length,decimals)] [uNSIGNED] [ZEROFILL]

| FLOAT[(length,decimals)] [uNSIGNED] [ZEROFILL]

| DECIMAL[(length[,decimals])] [uNSIGNED] [ZEROFILL]

| NUMERIC[(length[,decimals])] [uNSIGNED] [ZEROFILL]

| DATE

| TIME

| TIMESTAMP

| DATETIME

| YEAR

| CHAR[(length)]

[CHARACTER SET charset_name] [COLLATE collation_name]

| VARCHAR(length)

[CHARACTER SET charset_name] [COLLATE collation_name]

| BINARY[(length)]

| VARBINARY(length)

| TINYBLOB

| BLOB

| MEDIUMBLOB

| LONGBLOB

| TINYTEXT [bINARY]

[CHARACTER SET charset_name] [COLLATE collation_name]

| TEXT [bINARY]

[CHARACTER SET charset_name] [COLLATE collation_name]

| MEDIUMTEXT [bINARY]

[CHARACTER SET charset_name] [COLLATE collation_name]

| LONGTEXT [bINARY]

[CHARACTER SET charset_name] [COLLATE collation_name]

| ENUM(value1,value2,value3,...)

[CHARACTER SET charset_name] [COLLATE collation_name]

| SET(value1,value2,value3,...)

[CHARACTER SET charset_name] [COLLATE collation_name]

| spatial_type

 

index_col_name:

col_name [(length)] [ASC | DESC]

 

index_type:

USING {BTREE | HASH}

 

index_option:

KEY_BLOCK_SIZE [=] value

| index_type

| WITH PARSER parser_name

| COMMENT 'string'

 

reference_definition:

REFERENCES tbl_name (index_col_name,...)

[MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]

[ON DELETE reference_option]

[ON UPDATE reference_option]

 

reference_option:

RESTRICT | CASCADE | SET NULL | NO ACTION

 

table_options:

table_option [[,] table_option] ...

 

table_option:

ENGINE [=] engine_name

| AUTO_INCREMENT [=] value

| AVG_ROW_LENGTH [=] value

| [DEFAULT] CHARACTER SET [=] charset_name

| CHECKSUM [=] {0 | 1}

| [DEFAULT] COLLATE [=] collation_name

| COMMENT [=] 'string'

| CONNECTION [=] 'connect_string'

| DATA DIRECTORY [=] 'absolute path to directory'

| DELAY_KEY_WRITE [=] {0 | 1}

| INDEX DIRECTORY [=] 'absolute path to directory'

| INSERT_METHOD [=] { NO | FIRST | LAST }

| KEY_BLOCK_SIZE [=] value

| MAX_ROWS [=] value

| MIN_ROWS [=] value

| PACK_KEYS [=] {0 | 1 | DEFAULT}

| PASSWORD [=] 'string'

| ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT}

| TABLESPACE tablespace_name [sTORAGE {DISK|MEMORY|DEFAULT}]

| UNION [=] (tbl_name[,tbl_name]...)

 

partition_options:

PARTITION BY

{ [LINEAR] HASH(expr)

| [LINEAR] KEY(column_list)

| RANGE{(expr) | COLUMNS(column_list)}

| LIST{(expr) | COLUMNS(column_list)} }

[PARTITIONS num]

[sUBPARTITION BY

{ [LINEAR] HASH(expr)

| [LINEAR] KEY(column_list) }

[sUBPARTITIONS num]

]

[(partition_definition [, partition_definition] ...)]

 

partition_definition:

PARTITION partition_name

[VALUES

{LESS THAN {(expr | value_list) | MAXVALUE}

|

IN (value_list)}]

[[sTORAGE] ENGINE [=] engine_name]

[COMMENT [=] 'comment_text' ]

[DATA DIRECTORY [=] 'data_dir']

[iNDEX DIRECTORY [=] 'index_dir']

[MAX_ROWS [=] max_number_of_rows]

[MIN_ROWS [=] min_number_of_rows]

[TABLESPACE [=] tablespace_name]

[NODEGROUP [=] node_group_id]

[(subpartition_definition [, subpartition_definition] ...)]

 

subpartition_definition:

SUBPARTITION logical_name

[[sTORAGE] ENGINE [=] engine_name]

[COMMENT [=] 'comment_text' ]

[DATA DIRECTORY [=] 'data_dir']

[iNDEX DIRECTORY [=] 'index_dir']

[MAX_ROWS [=] max_number_of_rows]

[MIN_ROWS [=] min_number_of_rows]

[TABLESPACE [=] tablespace_name]

[NODEGROUP [=] node_group_id]

 

select_statement:

[iGNORE | REPLACE] [AS] SELECT ... (Some valid select statement)

Compartilhar este post


Link para o post
Compartilhar em outros sites

Boa noite amigo,

 

Quais suas dúvidas especificamente? Já tentou criar uma tabela pelo assistente gráfico do phpMyAdmin e observar a sintaxe do comando que ele gera? Já procurou exemplos na internet?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Pra mim esta bem claro o que esta escrito na documentação.

Poste o comando utilizado e os erros exibidos.

 

 

ok pessoal obrigado achei o problema eu estava inserindo aspas simples ao inves de crase no pronpt sql agora so mais uma coisa nao sei como se faz uma crase no teclado estou copiando e colando a crase se alguem puder me ajudar agradeço...

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.