MySQL是一個(gè)關(guān)系型數(shù)據(jù)庫(kù)管理系統(tǒng),由瑞典MySQL AB 公司開(kāi)發(fā),目前屬于 Oracle 旗下產(chǎn)品。MySQL 是最流行的關(guān)系型數(shù)據(jù)庫(kù)管理系統(tǒng)之一,在 WEB 應(yīng)用方面,MySQL是最好的 RDBMS (Relational Database Management System,關(guān)系數(shù)據(jù)庫(kù)管理系統(tǒng)) 應(yīng)用軟件。那么要使用mysql進(jìn)行數(shù)據(jù)庫(kù)增刪改查的操作一定需要用到數(shù)據(jù)庫(kù)操作的相關(guān)語(yǔ)句,下面就由小編為您帶來(lái)mysql增刪改查語(yǔ)句的相關(guān)介紹。
MySQL企業(yè)版:最全面的一組高級(jí)特性、管理工具和技術(shù)支持,以實(shí)現(xiàn)MySQL的最高級(jí)別的可伸縮性、安全性、可靠性和正常運(yùn)行時(shí)間。 用于OEM/ISV的MySQL:2000多家ISV、OEM和VAR依靠MySQL作為其產(chǎn)品的嵌入式數(shù)據(jù)庫(kù),使它們的應(yīng)用程序、硬件和設(shè)備更具競(jìng)爭(zhēng)力,使它們更快地進(jìn)入市場(chǎng),并降低產(chǎn)品銷(xiāo)售成本。 MySQL集群CGE:MySQL集群使用戶(hù)能夠以不妥協(xié)的可伸縮性、正常運(yùn)行時(shí)間和敏捷性來(lái)應(yīng)對(duì)下一代Web、云和通信服務(wù)帶來(lái)的數(shù)據(jù)庫(kù)挑戰(zhàn)。
mysql數(shù)據(jù)庫(kù)
創(chuàng)建數(shù)據(jù)庫(kù):
1、在cmd窗口中輸入mysql -u root -p登錄MySQL環(huán)境
2、創(chuàng)建數(shù)據(jù)庫(kù)
為了便于在命令提示符下顯示中文, 在創(chuàng)建時(shí)通過(guò) character set gbk 將數(shù)據(jù)庫(kù)字符編碼指定為 gbk
3、要對(duì)一個(gè)數(shù)據(jù)庫(kù)進(jìn)行操作, 必須先選擇該數(shù)據(jù)庫(kù)mysql -D database -u root -p
Database changed:有該提示表示可以成功使用class這個(gè)數(shù)據(jù)庫(kù)
創(chuàng)建數(shù)據(jù)庫(kù)表:
插入數(shù)據(jù)庫(kù)
mysql> insert into students values(NULL,“王剛”,“男”,20,“12345678”);
Query OK, 1 row affected (0.53 sec)
查詢(xún)數(shù)據(jù)庫(kù):
mysql> select name,age from students;
±-------±----+
| name | age |
±-------±----+
| 王剛 | 20 |
±-------±----+
1 row in set (0.30 sec)
mysql> select * from students;
±—±-------±----±----±---------+
| id | name | sex | age | tel |
±—±-------±----±----±---------+
| 1 | 王剛 | 男 | 20 | 12345678 |
±—±-------±----±----±---------+
1 row in set (0.00 sec)
插入數(shù)據(jù)庫(kù):
mysql> insert into students values(NULL,“鐘無(wú)艷”,“女”,100,“987654321”);
Query OK, 1 row affected (0.35 sec)
mysql> select * from students;
±—±----------±----±----±----------+
| id | name | sex | age | tel |
±—±----------±----±----±----------+
| 1 | 王剛 | 男 | 20 | 12345678 |
| 2 | 鐘無(wú)艷 | 女 | 100 | 987654321 |
±—±----------±----±----±----------+
2 rows in set (0.00 sec)
查詢(xún)數(shù)據(jù)庫(kù):
mysql> select * from students where sex=“女”;
±—±----------±----±----±----------+
| id | name | sex | age | tel |
±—±----------±----±----±----------+
| 2 | 鐘無(wú)艷 | 女 | 100 | 987654321 |
±—±----------±----±----±----------+
1 row in set (0.28 sec)
修改數(shù)據(jù)庫(kù):
mysql> update students set tel = 123 where id = 2;
Query OK, 1 row affected (0.36 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from students;
±—±----------±----±----±---------+
| id | name | sex | age | tel |
±—±----------±----±----±---------+
| 1 | 王剛 | 男 | 20 | 12345678 |
| 2 | 鐘無(wú)艷 | 女 | 100 | 123 |
±—±----------±----±----±---------+
2 rows in set (0.00 sec)
刪除數(shù)據(jù)庫(kù):
mysql> delete from students where id=1;
Query OK, 1 row affected (0.35 sec)
mysql> select * from students;
±—±----------±----±----±-----+
| id | name | sex | age | tel |
±—±----------±----±----±-----+
| 2 | 鐘無(wú)艷 | 女 | 100 | 123 |
±—±----------±----±----±-----+
1 row in set (0.00 sec)
修改數(shù)據(jù)庫(kù):
mysql> update students set id = 1 where id = 1;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
mysql> select * from students;
±—±----------±----±----±-----+
| id | name | sex | age | tel |
±—±----------±----±----±-----+
| 2 | 鐘無(wú)艷 | 女 | 100 | 123 |
±—±----------±----±----±-----+
1 row in set (0.00 sec)
mysql> update students set id = 1 where id = 2;
Query OK, 1 row affected (0.40 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from students;
±—±----------±----±----±-----+
| id | name | sex | age | tel |
±—±----------±----±----±-----+
| 1 | 鐘無(wú)艷 | 女 | 100 | 123 |
±—±----------±----±----±-----+
1 row in set (0.00 sec)
伴隨著云計(jì)算的發(fā)展和大數(shù)據(jù)時(shí)代的到來(lái),關(guān)系型數(shù)據(jù)庫(kù)越來(lái)越難以滿(mǎn)足需求,這主要是因?yàn)樾枰獙?duì)越來(lái)越多的半關(guān)系型和非關(guān)系型數(shù)據(jù)進(jìn)行存儲(chǔ)管理,作為一種方式,分布式技術(shù)等新技術(shù)的出現(xiàn)也對(duì)數(shù)據(jù)庫(kù)技術(shù)提出了新的要求,因此出現(xiàn)了越來(lái)越多的非關(guān)系型數(shù)據(jù)庫(kù),這一類(lèi)型與傳統(tǒng)的關(guān)系型數(shù)據(jù)庫(kù)在設(shè)計(jì)和數(shù)據(jù)結(jié)構(gòu)上有很大不同,它們更加強(qiáng)調(diào)數(shù)據(jù)庫(kù)數(shù)據(jù)的高并發(fā)讀寫(xiě)和大數(shù)據(jù)存儲(chǔ),這一類(lèi)型通常稱(chēng)為NoSQL數(shù)據(jù)庫(kù)。然而,傳統(tǒng)關(guān)系型數(shù)據(jù)庫(kù)如Mysql,在傳統(tǒng)領(lǐng)域中仍然具有很強(qiáng)的生命力。以上就是小編為您帶來(lái)的mysql增刪改查語(yǔ)句的相關(guān)介紹,希望對(duì)您有所幫助。
[免責(zé)聲明]
文章標(biāo)題: Mysql是什么?Mysql增刪改查語(yǔ)句介紹
文章內(nèi)容為網(wǎng)站編輯整理發(fā)布,僅供學(xué)習(xí)與參考,不代表本網(wǎng)站贊同其觀點(diǎn)和對(duì)其真實(shí)性負(fù)責(zé)。如涉及作品內(nèi)容、版權(quán)和其它問(wèn)題,請(qǐng)及時(shí)溝通。發(fā)送郵件至36dianping@36kr.com,我們會(huì)在3個(gè)工作日內(nèi)處理。