利用MySQL創(chuàng)建數(shù)據(jù)表


查看創(chuàng)建表:show tables;

查看創(chuàng)建表基本結(jié)構(gòu)語句:describe 表的名字;

查看創(chuàng)建表中信息的結(jié)構(gòu)語句:show create table 表的名字;

修改表:alter table 表的名字-----(用于更改原有表的結(jié)構(gòu))
增加表的字段:add address 增加的字段;(添加操作后,也可以執(zhí)行“describe?student;”命令查看結(jié)果。)

修改表名:alter table 舊名字 rename to 新名字;

刪除字段:alter table 表名字 drop 表中要刪除的字段;

刪除數(shù)據(jù)庫表:drop table 表的名字;(代碼運行成功,從數(shù)據(jù)庫中刪除表,在執(zhí)行代碼之前,先用desc語句查看是否存在表,以便與刪除后進(jìn)行對比。)

表記錄的修改:>table 舊內(nèi)容 set 新內(nèi)容? ? ?->where 舊內(nèi)容(用update..set..命令可以修改一個表的數(shù)據(jù))
mysql>update score set daily=80
? ? ? ? ?-> where studentno='1813722508'&& courseno='c08106';
mysql> select * form score
? ? ? ? -> where studentno='1813722508'&& courseno='c08106';
mysql>update student01 set entrance=student01*1.08 where?entrance<700;
表記錄的刪除:delete from 舊內(nèi)容 where 滿足的條件(利用?delete...from...語句可以從單個表中刪除指定表數(shù)據(jù))
mysql>delete from student01 where?entrance<750;
mysql>delete from student01 order by?entrance limit 2;