鏁版嵁搴撶瑪璁?馃搾 MySQL鍩虹鎿嶄綔鍛戒护 鍒嗙被娓呮櫚
Posted 08kruokl
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了鏁版嵁搴撶瑪璁?馃搾 MySQL鍩虹鎿嶄綔鍛戒护 鍒嗙被娓呮櫚相关的知识,希望对你有一定的参考价值。
MySQL 鍩虹鎿嶄綔鍛戒护锛屽寘鎷鏁版嵁搴撱€佹暟鎹〃銆佹暟鎹殑鎿嶄綔銆?/blockquote>涓€銆佸搴撶殑鎿嶄綔
1.1 鏌ョ湅
show schemas/databases;
1.2 閫夋嫨搴?/p>
use demo;
1.3 鍒涘缓
create database/schema demo;
1.4 鍒犻櫎
drop database/schema demo;
浜屻€佸琛ㄧ殑鎿嶄綔
2.1 鏌ョ湅
show tables;
2.2 鍒涘缓
create table if not exists job( -> id int not null auto_increment, -> job_name varchar(50) not null, -> job_desc varchar(200) not null, -> primary key (id));
2.3 鍒犻櫎
drop table job;
2.4 娓呯┖琛ㄦ暟鎹?/p>
delete from job;
2.5 琛ㄥ瓧娈垫搷浣?/h4>
2.5.1 鏌ョ湅琛ㄥ瓧娈?/p>
desc job; 鎴栬€?show create table job;
2.5.2 澧炲姞琛ㄥ瓧娈?add
alter table job add job_desc varchar(200);
2.5.3 淇敼琛ㄥ瓧娈?change,淇敼琛ㄥ瓧娈电被鍨嬪強鍚嶇О锛歮odify
alter table job change job_desc job_text varchar(200); alter table job modify job_name varchar(50);
2.5.4 鍒犻櫎琛ㄥ瓧娈?drop
alter table job drop job_desc; 濡傛灉鏁版嵁琛ㄤ腑鍙墿浣欎竴涓瓧娈靛垯鏃犳硶浣跨敤DROP鏉ュ垹闄ゅ瓧娈?/code>
2.5.5 绉诲姩琛ㄥ瓧娈典綅缃細add鍜宮odify鏃舵墠鍙敤
alter table job add job_desc first; alter table job modify job_desc varchar(200) after id;
3. 鏁版嵁鎿嶄綔
3.1 澧烇細
insert into test.job (job_name,job_desc) values ("鍓嶇宸ョ▼甯?,"鍓嶇寮€鍙憍xx"); insert into test.job values (2,"娴嬭瘯","娴嬭瘯绯荤粺鐨刡ug"); insert into test.job values (5,"鍚庡彴寮€鍙戝伐绋嬪笀","绯荤粺鍚庡彴鏈嶅姟鎺ュ彛鐨勫紑鍙憍xxx"); insert into test.job (job_name,job_desc) values ("缇庡伐","璁捐鐣岄潰UI");
3.2 鍒狅細
delete from job where job_name = "娴嬭瘯";
3.3 鏀?
update job set job_desc = "娴嬭瘯"; update job set job_desc = "鍓嶇娴嬭瘯xxxxx" where job_name = "鍓嶇宸ョ▼甯?;
3.4 鏌?
select job_desc from job where job_name = "test";
以上是关于鏁版嵁搴撶瑪璁?馃搾 MySQL鍩虹鎿嶄綔鍛戒护 鍒嗙被娓呮櫚的主要内容,如果未能解决你的问题,请参考以下文章