sql甯哥敤鍛戒护

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql甯哥敤鍛戒护相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/%e8%ae%b0%e5%bd%95' title='璁板綍'>璁板綍   淇敼   ble   鎸囦护   lock   ike   drop   href   甯哥敤   

DDL 鏁版嵁搴撴ā寮忓畾涔夎瑷€(Data Definition Language)锛岃礋璐f暟鎹粨鏋勫畾涔変笌鏁版嵁搴撳璞″畾涔夌殑璇█銆?/p>

  鍒涘缓鏁版嵁搴?CREATE DATABASE
  鍒涘缓鏁版嵁搴撹〃鏍?CREATE TABLE
  淇敼鏁版嵁搴撹〃鏍?ALTER TABLE
  鍒犻櫎鏁版嵁搴撹〃鏍?DROP TABLE
e.g 灏嗘暟鎹〃emp鏀瑰悕涓篹mpdep
alter table emp rename empdep;

DML 鏁版嵁鎿嶇旱璇█锛圖ata Manipulation Language锛?/p>

  select 妫€绱?  insert 鎻掑叆
  update 鏇存柊
  delete
e.g UPDATE 璇彞鐢ㄤ簬鏇存柊琛ㄤ腑鐨勮褰?UPDATE user
SET username=鈥榬obot鈥? password=鈥榬obot鈥?WHERE usename=鈥榬obot鈥?
e.g 鏌ヨ澶氬垪
SELECT prod_id, prod_name, prod_price
FROM products;

e.g 鏌ヨ鎵€鏈夊垪
SELECT *
FROM products;

DCL 鏁版嵁鎺у埗璇█ (Data Control Language锛夋槸涓€绉嶅彲瀵规暟鎹闂潈杩涜鎺у埗鐨勬寚浠?/p>

  commit
  rollback
  grant
  revoke

鎺堜簣鏉冮檺
GRANT SELECT, INSERT ON *.* TO myuser;
鍒犻櫎鏉冮檺
REVOKE SELECT, INSERT ON *.* FROM myuser;

ON *.* 鍗虫墍鏈夋暟鎹簱閮芥湁鏁堢殑鎰忔€?/code>

IN 鍜?BETWEEN

  • IN 鎿嶄綔绗﹀湪 WHERE 瀛愬彞涓娇鐢紝浣滅敤鏄湪鎸囧畾鐨勫嚑涓壒瀹氬€间腑浠婚€変竴涓€笺€?/li>
  • BETWEEN 鎿嶄綔绗﹀湪 WHERE 瀛愬彞涓娇鐢紝浣滅敤鏄€夊彇浠嬩簬鏌愪釜鑼冨洿鍐呯殑鍊笺€?/li>

IN 绀轰緥

SELECT *
FROM products
WHERE vend_id IN (鈥楧LL01鈥? 鈥楤RS01鈥?;

BETWEEN 绀轰緥

SELECT *
FROM products
WHERE prod_price BETWEEN 3 AND 5;

LIKE鎿嶄綔绗﹀湪 WHERE 瀛愬彞涓娇鐢紝瀛楁鏄枃鏈€兼椂鎵嶄娇鐢?LIKE銆?br> LIKE 鏀寔涓や釜閫氶厤绗﹀尮閰嶉€夐」锛? 鍜?銆?br> % 琛ㄧず浠讳綍瀛楃鍑虹幇浠绘剰娆℃暟銆?/em> 琛ㄧず浠讳綍瀛楃鍑虹幇涓€娆°€?/p>

% 绀轰緥

SELECT prod_id, prod_name, prod_price
FROM products
WHERE prod_name LIKE 鈥?bean bag%鈥?

https://zhuanlan.zhihu.com/p/157502036




以上是关于sql甯哥敤鍛戒护的主要内容,如果未能解决你的问题,请参考以下文章

Linux甯哥敤鍛戒护

Linux甯哥敤鍛戒护

Linux甯哥敤鍛戒护

git甯哥敤鍛戒护

linux甯哥敤鍛戒护--宸ヤ綔璁板綍20201126

linux鏃ュ父甯哥敤鍛戒护鏁寸悊