[微精通:網頁設計Vue + Node.js + MySQL] 5.1.MySQL & SQL (下)

想要永久保存資料,我們就必須使用資料庫,顧名思意,就是資料的倉庫。此為下半部份。

 

image/svg+xml { id : 1 , name : ' 瘋狂傑克 ' , age : 3.3 , isVegetarian : true , typeImgSrc : “z1.png" } use ZombieDB ; INSERT INTO Zombie ( Name , age, isVegetarian, typeImgSrc ) VALUES ( ' 瘋狂傑克 ' , 3 . 3 , 1 , ‘z1.png' ) ; SELECT LAST_INSERT_ID (); INSERT INTO Zombie ( Name , age, isVegetarian, typeImgSrc) VALUES ( ' 懶懶瑪琍 ' , 10 , 1 , 'z2.png' ); INSERT INTO Zombie ( Name , age, isVegetarian, typeImgSrc) VALUES ( ' ⼤提姆 ' , 5 , 0 , 'z3.png' ); INSERT INTO Zombie ( Name , age, isVegetarian, typeImgSrc) VALUES ( ' 史提夫 ' , 2 , 0 , 'z4.png' ); INSERT INTO Zombie ( Name , age, isVegetarian, typeImgSrc) VALUES ( ' 功夫李 ' , 1 , 1 , 'z5.png' ); use ZombieDB; SELECT * FROM Zombie ; SELECT id , Name FROM Zombie; use ZombieDB; UPDATE Zombie SET name = ' 懶懶瑪琍 ' , age = 11 , isVegetarian = 1 , typeImgSrc = 'z3.png' WHERE id = 2 ; use ZombieDB; DELETE FROM Zombie WHERE id = 1 ;