av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

MySQL數(shù)據(jù)庫的基本操作演示

以下的文章主要向大家描述的是MySQL數(shù)據(jù)庫的基本操作,提及MySQL數(shù)據(jù)庫我們大家對其可能都會有一定的了解,今天我們就和大家一起討論一下MySQL數(shù)據(jù)庫的基本操作,望你能有所收獲。

登陸數(shù)據(jù)庫

D:\phpStudy\MySQL\bin>MySQL -uroot -proot

查看數(shù)據(jù)庫

MySQL> show databases;

選擇數(shù)據(jù)庫

MySQL> use bugfree;

設(shè)置字符集

MySQL> set names 'gbk';

查詢數(shù)據(jù)庫中的表

MySQL> show tables;

MySQL數(shù)據(jù)庫的基本操作 ;創(chuàng)建表

MySQL> create table test(

-> tid int(10) not null,

-> tname varchar(100) not null,

-> tdate datetime not null default '0000-00-00',

-> primary key (tid));

查看表結(jié)構(gòu)

MySQL> desc test;

添加列

MySQL> alter table test add(tage int(3));

修改原表結(jié)構(gòu)

MySQL> alter table test modify tage int(5) not null;

修改列的默認值

MySQL> alter table test alter tage set default '0';

去掉列的默認值

MySQL> alter table test alter tage drop default;

刪除列

MySQL> alter table test drop column tage;

插入數(shù)據(jù)

MySQL> insert into test(tid,tname,tdate) value(1,'yangjuqi','2008-03-21');

查詢數(shù)據(jù)

MySQL> select * from test;

模糊查詢

MySQL> select * from test where tname like '%楊%';

MySQL數(shù)據(jù)庫的基本操作 :修改數(shù)據(jù)

MySQL> update test set tname='張三' where tid='2';

刪除數(shù)據(jù)

MySQL> delete from test where tid='2';

刪除表

MySQL> drop table test;

重命名表

MySQL> alter table test rename testbak;

分頁查詢(limit 起始行,取多少行)

MySQL> select * from testbak limit 2,1;

刷新數(shù)據(jù)庫

MySQL> flush privileges;

顯示數(shù)據(jù)庫版本

MySQL> select version();

顯示當前時間

MySQL> select current_date;

修改用戶密碼

D:\phpStudy\MySQL\bin>MySQLadmin -uroot -proot password yangjuqi

將查詢出的數(shù)據(jù)寫入文件

MySQL> select * from testbak into outfile "d:/test.txt" fields terminated by ",";

查看數(shù)據(jù)庫狀態(tài)

MySQL> status;

查看所有編碼

MySQL> show variables like 'character_set_%';

導(dǎo)入sql文件命令

以上的相關(guān)內(nèi)容就是對MySQL數(shù)據(jù)庫的基本操作的介紹,望你能有所收獲。


當前文章:MySQL數(shù)據(jù)庫的基本操作演示
URL地址:http://uogjgqi.cn/article/cdjhsec.html
掃二維碼與項目經(jīng)理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流