Home > Database > Mysql Tutorial > mysql tips

mysql tips

黄舟
Release: 2017-01-16 13:15:47
Original
1190 people have browsed it

View the table creation statement of a table show CREATE table [table name];

For example: display the table creation statement of the goods table show CREATE table goods;
Result

CREATE TABLE `goods` (
`goods_id` mediumint(8) unsigned NOT NULL auto_increment,
`cat_id` smallint(5) unsigned NOT NULL default '0',
`goods_sn` varchar(60) NOT NULL default '',
`goods_name` varchar(120) NOT NULL default '',
`click_count` int(10) unsigned NOT NULL default '0',
`goods_number` smallint(5) unsigned NOT NULL default '0',
`market_price` decimal(10,2) unsigned NOT NULL default '0.00',
`shop_price` decimal(10,2) unsigned NOT NULL default '0.00',
`add_time` int(10) unsigned NOT NULL default '0',
`is_best` tinyint(1) unsigned NOT NULL default '0',
`is_new` tinyint(1) unsigned NOT NULL default '0',
`is_hot` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`goods_id`)
) ENGINE=MyISAM AUTO_INCREMENT=34 DEFAULT CHARSET=utf8;
Copy after login

#Import the contents of another library table into the current table (import the contents of the goods table in the shop library into the goods table in the test library)

insert into test.goods
select goods_id,cat_id,goods_sn,goods_name,click_count,goods_number,market_price,shop_price,add_time,is_best,is_new,is_hot 
from shop.goods;
Copy after login

The above is mysql small For technical content, please pay attention to the PHP Chinese website (www.php.cn) for more related content!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template