mysql创建book表_【mysql】表的创建以及基本操作
1.表的創(chuàng)建
create table tablennme(object type);
如川建一個(gè)book的表
create table book(book_id int(5),
book_name char(20),
book_author char(20));
表示有一個(gè)book_id ,book_name ,book_author的列,類型分別為int char char;
2.表的插入列
alter table tablename add newlinename type;
如在上例中增加列book_date,類型為date;
alter table book addbook_date date;
3.修改表中數(shù)據(jù)
update tablename set ?需修改的地方 where 限定修改的地點(diǎn)
如已有book_id=1,book_name=mysql,book_author=abc,book_date=2013-12-6;現(xiàn)修改book_author=bcd;
update book set book_author=bcd where book_id=1;
4.修改列的類型
alter table tablename modify 列名 新類型
如將book_id的int 變?yōu)閏har;
alter table book modfiy book_id char(5);
5修改列名
alter table tablename change 原名 新名 新類型
6.修改列的順序
alter table tablename modify 列名 類型 after 另一列
7.刪除列
alter table tablename drop 列名;
總結(jié)
以上是生活随笔為你收集整理的mysql创建book表_【mysql】表的创建以及基本操作的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux不可用于文件名的符号,Linu
- 下一篇: WPF使用GMap.net框架开发地图应