Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Mysql¶à±í²éѯ£¬¶à±í²åÈëºÍ¶à±í¸üÐÂ

/*************************************by
garcon1986*****************************************************/
¶à±í²éѯ£º
CREATE TABLE IF NOT EXISTS contact(
contact_id int(11) NOT NULL AUTO_INCREMENT,
user_name varchar(255),
nom varchar(255),
prenom varchar(255),
mail varchar(64),
passcode char(64),
PRIMARY KEY(contact_id)
);
CREATE TABLE IF NOT EXISTS droit(
droit_id int( 11 ) NOT NULL AUTO_INCREMENT ,
droit varchar(255),
PRIMARY KEY(droit_id)
);
CREATE TABLE IF NOT EXISTS contactdroit(
contactdroit_id int(11) NOT NULL AUTO_INCREMENT,
contact_id int( 11 ),
droit_id int( 11 ),
PRIMARY KEY( contactdroit_id )
);
Insert into contact(contact_id, user_name) values(1,'user1');
Insert into contact(contact_id, user_name) values(2,'user2');
Insert into contact(contact_id, user_name) values(3,'user3');
Insert into droit(droit_id, droit) values(1,'admin');
Insert into droit(droit_id, droit) values(2,'superuser');
Insert into contactdroit(contact_id, droit_id) values(1, 1);
Insert into contactdroit(contact_id, droit_id) values(2, 1);
Insert into contactdroit(contact_id, droit_id) values(3, 2);
SELECT c.contact_id, d.droit_id, d.droit from contact c, contactdroit
cd, droit d
where c.contact_id = cd.contact_id
and cd.droit_id = d.droit_id;
½á¹û£º
contact_id     droit_id     droit
1                      1           admin
2                      1           admin
3                      2          superuser
¶à±íÁª²éÀý×Ó£º
Á½¸ö·½·¨¶¼¿ÉÒÔ£¬inner join on ¸üºÃµã¡£
±í½á¹¹Ã»Ìù³öÀ´£¬µ«±È½ÏºÃ¶®ÁË¡£
¼òµ¥·½·¨£º
select c.nom, e.nom
from consul


Ïà¹ØÎĵµ£º

mysql µ¼Èë¡¢µ¼³öÊý¾Ý¿â¡¢±í

DOS¡¡´°¿Ú
¿ªÊ¼£­£¾ÔËÐУ­£¾¡¡cmd
µ¼³öΪ£º¡¡mysqldump -u Óû§Ãû -p  --opt  Êý¾Ý¿âÓû§Ãû >
Êý¾Ý¿âÃû.sql
ÊäÈëÄãµÄÊý¾Ý¿âÃÜÂë!phpma.com
µ¼ÈëΪ£ºmysql -u Óû§Ãû -p Êý¾Ý¿âÓû§Ãû < Êý¾Ý¿âÃû.sql
£¨Òª
ÔÚµ±Ç°Ä¿Â¼Ï²Ù×÷£©
ÒªÏ뽫Îı¾Îļþ

pet.txt

×°Ôص½
pet
±íÖУ¬Ê¹Ó ......

MYSQL³õѧÕßʹÓÃÖ¸ÄÏ

http://www.chinalinuxpub.com/read.php?wid=45
ÓкܶàÅóÓÑËäÈ»°²×°ºÃÁËmysqlµ«È´²»ÖªÈçºÎʹÓÃËü¡£ÔÚÕâƪÎÄÕÂÖÐÎÒÃǾʹÓÁ¬½ÓMYSQL¡¢ÐÞ¸ÄÃÜÂë¡¢Ôö¼ÓÓû§µÈ·½ÃæÀ´Ñ§Ï°Ò»Ð©MYSQLµÄ³£ÓÃÃüÁî¡£
Ò»¡¢Á¬½ÓMYSQL¡£
¸ñʽ£º mysql -hÖ÷»úµØÖ· -uÓû§Ãû £­pÓû§ÃÜÂë
1¡¢Àý1£ºÁ¬½Óµ½±¾»úÉϵÄMYSQL¡£
Ê×ÏÈÔÚ´ò¿ªDOS´°¿Ú£¬È»ºó½øÈëÄ¿ ......

MySQL Êý¾Ý¿â³£ÓÃÃüÁî


1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖظ´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âÇ°£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°ÈÕÆÚ
s ......

phpÏòMySQL²åÈëÊý¾Ý²»È« ½â¾ö·½·¨

½ñÌìΪÁËһЩÒÑÓÐÊý¾Ýµ¼ÈëMYSQLµÄÊý¾Ý¿â£¬ÎÒдÁËÒ»¸öºÜ¼òµ¥µÄPHP³ÌÐò¡£
³ÌÐò˼·ºÜ¼òµ¥£¬¾ÍÊǶÁÒ»ÌõÊý¾Ý£¬È»ºóÍùMYSQLÀï²åÈëÒ»Ìõ¡£
½á¹û×ÜÊÇ·¢ÏÖ Ã¿´Îµ¼ÈëÖ»Äܵ¼Èë2000Ìõ£¬¾Í×Ô¶¯Í£Ö¹ÁË£¬¶øÇÒûÓÐÈκÎÌáʾ¡£
ÔÚÍøÉÏËѽâ¾ö·½°¸¸÷ÖÖËѲ»µ½¡£
¸Õ¿ªÊ¼»³ÒÉÊÇÄڴ滺³å¸øÉÙÁË£¬µ÷ÁËһϣ¬»¹ÊDz»ÐС£¡£
×îºó·¢ÏÖÒ»¸ö¹æÂÉ£¬¾ÍÊÇ ......

MySQL decimal ÀàÐÍ

      Ò»°ã¸³Ó踡µãÁеÄÖµ±»ËÄÉáÎåÈëµ½Õâ¸öÁÐËùÖ¸¶¨µÄÊ®½øÖÆÊý¡£Èç¹ûÔÚÒ»¸öFLOAT(8, 1)µÄÁÐÖд洢1. 2 3 4 5 6£¬Ôò½á¹ûΪ1. 2¡£Èç¹û½«ÏàͬµÄÖµ´æÈëFLOAT(8, 4) µÄÁÐÖУ¬Ôò½á¹ûΪ1. 2 3 4 6¡£Õâ±íʾӦ¸Ã¶¨Òå¾ßÓÐ×㹻λÊýµÄ¸¡µãÁÐÒÔ±ãµÃµ½¾¡¿ÉÄܾ«È·µÄÖµ¡£Èç¹ûÏ뾫ȷµ½Ç§·ÖÖ®Ò»£¬ÄǾͲ»Òª¶¨Òåʹ¸ÃÀà ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ