???????????????????????MySQL?????????????MySQL???Ч????????????????????????????MySQL?????????
?????????????У?????ν?????????????????????????????????????? mytable???
????CREATE TABLE mytable(   ID INT NOT NULL??    username VARCHAR(16) NOT NULL  );   ??????????????????10000??????????????????5555?? admin??
?????????username="admin"???? SELECT * FROM mytable WHERE username='admin';????????username?????????????????MySQL?????κ???裬??????????ü????????MySQL????????м??????????10000???????
?????????????????????????????????????????????????????????У??????????ж???????????????????????????????????????????????????С?
????MySQL?????????????
??????1?????????
?????????????????????????κ?????????????????????????
?????????????
????CREATE INDEX indexName ON mytable(username(length)); ?????CHAR??VARCHAR?????length????С?????????????????BLOB??TEXT???????????? length???????
???????????
????ALTER mytable ADD INDEX [indexName] ON (username(length))
?????????????????????
????CREATE TABLE mytable(   ID INT NOT NULL??    username VARCHAR(16) NOT NULL??   INDEX [indexName] (username(length))   );  ?????????????
????DROP INDEX [indexName] ON mytable;
??????2??????
?????????????????????????????????????е?????????????п??????????????????????????????????????????????????
?????????????
????CREATE UNIQUE INDEX indexName ON mytable(username(length))
???????????
????ALTER mytable ADD UNIQUE [indexName] ON (username(length))
?????????????????????
????CREATE TABLE mytable(   ID INT NOT NULL??    username VARCHAR(16) NOT NULL??   UNIQUE [indexName] (username(length))   );
??????3??????????
?????????????????????????????п??????????????????????????????????
????CREATE TABLE mytable(   ID INT NOT NULL??    username VARCHAR(16) NOT NULL??   PRIMARY KEY(ID)   );  ?????????? ALTER ???????????????????????????

??????4?????????
??????????????????????????????????????????Σ?
????CREATE TABLE mytable(   ID INT NOT NULL??    username VARCHAR(16) NOT NULL??   city VARCHAR(50) NOT NULL??   age INT NOT NULL  );  ?????????MySQL??Ч??????????????????????? name?? city?? age?????????????
????ALTER TABLE mytable ADD INDEX name_city_age (name(10)??city??age); ???????usernname????? 16???????? 10??????????????????????????????10???????????????????????????????????????С?????INSERT?????????
???????????? usernname??city??age?????????????????????3???????????????????????????????Ч?????????????????????????????????????????????????????MySQL?????????е????????????????Ч????????????
???????????????????????????????????????????????????????
????usernname??city??age   usernname??city   usernname  ?????? city??age???????????????????????MySQL???????“????”??????????????????????????????????????????????е?????????????????????????????SQL?????????????????
????SELECT * FROM mytable WHREE username="admin" AND city="???"  SELECT * FROM mytable WHREE username="admin" ?????漸???????????
????SELECT * FROM mytable WHREE age=20 AND city="???"  SELECT * FROM mytable WHREE city="???"

??????5???????????????
??????????????????????????????????????????????????????????????????????WHERE??JOIN?г??????????????????????????????????MySQL???<??<=??=??>??>=??BETWEEN??IN??????Щ????LIKE???????????????磺
????SELECT t.Name  FROM mytable t LEFT JOIN mytable m    ON t.Name=m.username WHERE m.age=20 AND m.city='???' ????????city??age??????????????mytable???userame?????????JOIN????У???ж?????????????????
?????????????Щ????LIKE???軌???????????????????%??_???????????MySQL??????????????????????????????
????SELECT * FROM mytable WHERE username like'admin%' ???????????
????SELECT * FROM mytable WHEREt Name like'?min' ?????????LIKE??????????????
??????6??????????????
???????涼????????????????????????????????????????á????????????????????
????????????????????????????????????±?????????????INSERT??UPDATE??DELETE????????±????MySQL?????????????????????????????????
??????????????????????????????????????????????????????????????????????????????????????????????????????
??????????????Ч?????????????????MySQL?д????????????????????о????????????????????????
??????7??????????????????
?????????????????????Щ????????????
???????????????????NULL?????
?????????а?????NULL????????????????????У?????????????????к???NULL??????????ж???????????????Ч?????????????????????????????ε??????NULL??
??????????????
????????н???????????????????????????????????磬????????CHAR(255)???У???????10????20???????????????Ω?????????????????н??????????????????????????????????????????????I/O??????
????????????????
????MySQL??????????????????????where?????????????????????????order by?е???????????????????????????????????????????????2?????????????????????????????е????????????????Щ?д?????????????
??????like??????
???????????2????????like?????????????ò????????????????????like “?a%” ?????????????like “aaa%”?????????????
?????????????????????
????select * from users where YEAR(adddate)<2007; ?????????????????????????????Ч???????????裬????????????
????select * from users where adddate<‘2007-01-01’;
??????????NOT IN??<>????
???????????????MySQL?????????????????