ÔõôÔÚmysqlÖн¨ÉèlibraryÊý¾Ý¿â
Òª½¨Éè mysql Êý¾Ý¿â¡°library¡±£¬ÇëÏȽ¨Éè mysql ÅþÁ¬£¬È»ºóÖ´ÐÐÒÔÏ°취£º1. ½¨ÉèÊý¾Ý¿â£ºcreate database library; 2. Ñ¡ÔñÊý¾Ý¿â£ºuse library; 3. ½¨Éè±í£ºcreate table books (…); 4. ²åÈëÊý¾Ý£ºinsert into books (title, author) values (‘…’); 5. ÑéÖ¤Êý¾Ý¿â£ºshow databases; show tables;
ÔõÑù½¨Éè MySQL Êý¾Ý¿â¡°library¡±
ҪʹÓà MySQL ½¨ÉèÃûΪ¡°library¡±µÄÊý¾Ý¿â£¬Çëƾ֤ÒÔÏ°취²Ù×÷£º
½¨Éè MySQL ÅþÁ¬
ʹÓà MySQL ÏÂÁîÐпͻ§¶Ë»òµÚÈý·½¹¤¾ß£¨ÀýÈç MySQL Workbench£©ÅþÁ¬µ½ MySQL ЧÀÍÆ÷¡£
½¨ÉèÊý¾Ý¿â
Ö´ÐÐÒÔÏÂÏÂÁÉèÃûΪ¡°library¡±µÄÊý¾Ý¿â£º
CREATE DATABASE library;
µÇ¼ºó¸´ÖÆ
Ñ¡ÔñÊý¾Ý¿â
ʹÓÃÒÔÏÂÏÂÁîÑ¡Ôñн¨ÉèµÄ¡°library¡±Êý¾Ý¿â£º
USE library;
µÇ¼ºó¸´ÖÆ
½¨Éè±í
ÔÚ¡°library¡±Êý¾Ý¿âÖн¨Éè±í¸ñÒÔ´æ´¢Êý¾Ý£¬ÀýÈ磺
CREATE TABLE books ( id INT NOT NULL AUTO_INCREMENT, title VARCHAR(255) NOT NULL, author VARCHAR(255) NOT NULL, PRIMARY KEY (id) );
µÇ¼ºó¸´ÖÆ
²åÈëÊý¾Ý
ʹÓÃÒÔÏÂÏÂÁÊý¾Ý²åÈëµ½±íÖУº
INSERT INTO books (title, author) VALUES ('The Catcher in the Rye', 'J.D. Salinger');
µÇ¼ºó¸´ÖÆ
ÑéÖ¤Êý¾Ý¿â
ʹÓÃÒÔÏÂÏÂÁîÉó²é¡°library¡±Êý¾Ý¿âÊÇ·ñ±£´æ£º
SHOW DATABASES;
µÇ¼ºó¸´ÖÆ
ʹÓÃÒÔÏÂÏÂÁîÉó²é¡°library¡±Êý¾Ý¿âÖн¨ÉèµÄ±í£º
SHOW TABLES;
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇÔõôÔÚmysqlÖн¨ÉèlibraryÊý¾Ý¿âµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡