Adicionar Coluna em Tabela MySQL Já Existente
20 De Outubro De 2012 10 Comments
Para adicionar a coluna “idade” do tipo “int (11)” na tabela “aluno” basta usar a seguinte consulta SQL:
ALTER TABLE aluno ADD idade int(11)
ALTER TABLE aluno ADD idade int(11)
a consulta acima adicionará a coluna “idade” última coluna, caso queira definir a posição da coluna use a seguinte consulta SQL:
ALTER TABLE aluno ADD idade int(11) AFTER nome
ALTER TABLE aluno ADD idade int(11) AFTER nome
A consulta acima adicionará a tabela “idade” depois da coluna “nome“.
E se quiser que a coluna “idade” seja a primeira da tabela “aluno” a seguinte instrução o satisfará:
ALTER TABLE aluno ADD idade int(11) FIRST
ALTER TABLE aluno ADD idade int(11) FIRST
Editor Conquer Br para fins.
ALTER TABLE accounts ADD (`Code` varchar(15) NOT NULL DEFAULT '',
`country` varchar(125) DEFAULT NULL);
ALTER TABLE entities ADD (VipPoints int(255) NOT NULL DEFAULT '0',
`VipMonsterPoints` int(255) NOT NULL,
`lotterypoints` bigint(255) NOT NULL,
`TotalPerfectionScore` bigint(255) unsigned DEFAULT '0',
`strikePoints` bigint(16) DEFAULT NULL,
`UnionID` smallint(18) DEFAULT '0',
`Offical` smallint(12) DEFAULT '0',
`Harem` smallint(12) DEFAULT '0',
`Guards` smallint(12) DEFAULT '0',
`UnionExploits` bigint(18) DEFAULT '0',
`kingDay` bigint(255) DEFAULT '0',
`King` bigint(255) DEFAULT '0',
`Wardrobe` varchar(255) DEFAULT NULL,
`Windwalker` bigint(255) unsigned NOT NULL DEFAULT '0',
`HaveAllTitles` bigint(255) unsigned NOT NULL DEFAULT '0',
`DailySignedDays` longtext NOT NULL,
`DailySignRewards` bigint(255) unsigned NOT NULL DEFAULT '0',
`DailySignVIPChances` bigint(255) unsigned NOT NULL DEFAULT '0',
`KingdomDeed` bigint(255) unsigned NOT NULL DEFAULT '0',
`DonateTime` bigint(255) unsigned NOT NULL DEFAULT '0',
`DonationType` tinyint(5) unsigned NOT NULL DEFAULT '0',
`MessiPoints` bigint(255) NOT NULL,
`MystreyFruit` smallint(12) NOT NULL DEFAULT '0',
`VoteSystem` bigint(32) DEFAULT NULL);
ALTER TABLE guilds ADD (`UnionID` bigint(18) unsigned DEFAULT '0');
ALTER TABLE items ADD (`PerfectionProgress` bigint(255) unsigned DEFAULT '0',
`Stars` bigint(255) unsigned DEFAULT '0',
`Owner` varchar(16) DEFAULT NULL,
`OwnerUID` bigint(255) DEFAULT '0',
`Signature` varchar(16) DEFAULT NULL,
`TimeStamp` bigint(255) DEFAULT NULL,
`MinutesLeft` bigint(255) DEFAULT NULL,
`WingID` int(16) NOT NULL,
`TitleID` int(16) NOT NULL);
ALTER TABLE skills ADD (`UID` int(4) NOT NULL AUTO_INCREMENT); - MANUAL
Tabelas que tem que ser adicionadas.
compras
compras_recebimento
payments
products
vendas