Giáo trình SQL Đại Học Huế
Giaùo trỗnh thổỷc haỡnh SQL *,lv,7+,j8 64/6WUXFWXUHG4XHU\/DQJXDJH OD QJQQJ ÔFV GX£QJFKRFDFK£ TXDQ WU F V G OL£X TXDQ K£ 1JQ QJ 64/ FKXQ ÔF D UD EL $16, $PHULFDQ 1DWLRQDO 6WDQGDUGV ,QVWLWXGH YD ,62 ,QWHUQDWLRQDO 6WDQGDUGV 2UJDQL]DWLRQ YL SKLQ EDQ PL QK¢W KL£Q QD\ OD SKLQ EDQ 64/ SKLQ EDQ ÔF D UD QP 0ÊFGXFRQKLXQJQQJNKDFQKDXÔFDUDFKRFDFKÊ TXDQWU&6'/ TXDQKÊ64/OD QJQQJ ÔFV GXÊQJUÔQJUDLKLÊQQD\WURQJUÂWQKLXKÊ WKÂQJ &6'/WKQJPDÊLQK2UDFOH64/6HUYHU'%0LFURVRIW$FFHVV7KQJTXD64/ QJL V GXÊQJ FR WK GĂ GDQJ QK QJKD ÔF G OLÊX WKDR WDF YL G OL£X 0£W NKDF\OD QJQQJ FR WQKNKDLEDRQQQR G¡ V GX£QJYD FXQJYY£\PD WU QQ SK EL¢Q *LDRWULQKQD\QKPFXQJF¢SFKRED£QWDLOL£XWKDPNKDRWQJ¢L\X Y FDF FX O£QK JLDR WDF 64/ V GX£QJ FKR K£ TXDQ WU &6'/ 0LFURVRIW 64/ 6HUYHU *LDRWUQKEDRJPEÂQFKQJ &KQJ JLL WKLÊX PÔW V¢ FX O£QK V GX£QJ WURQJ YL£F QK QJKD FDF ÂL WÔQJGOLÊXQKEDQJGOLÊXNKXQJQKQYDFKPXÊF &KQJ WUQK ED\ EÂQ FX OÊQK WKDR WDF G OL£X OD 6(/(&7 ,16(57 83'$7(YD'(/(7(WURQJRW£SWUXQJFKX\¢XFXO£QK6(/(&7 &KQJF£S¢QKDLFXO£QKLXNKL QOD *5$17YD 5(92.(V GX£QJ WURQJYL£FF¢SSKDWYDKX\ERTX\QFXDQJLVGX£QJ&6'/ &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QJGOLÊXWURQJ&6'/ D.LXGOLX 0ĂL PÔW FÔW WUQJ FXD PÔW EDQJ X SKDL WKXÔF YDR PÔW NLX G OLÊX QKÂW QKD ÔFQKQJKDW WUF 0ĂL PÔW NLX G OLÊX TXL QK FDF JLD WU G OLÊX ÔFFKRSKHSÂLYLFÔWR&DFKÊTXDQWU&6'/WKQJFXQJFÂSFDFNLXGOLÊX FKXQQJRDLUDFRQFR WK FKRSKHSQJLV GXÊQJQKQJKDFDFNLXG OLÊXNKDF GÊDWUQFDFNLXGOLÊXDFR 'L\ODPÔWVÂNLXGOLÊXWKQJÔFVGXÊQJWURQJJLDRWDF64/ Binary Int Smallint Bit Money Smallmoney Char Nchar Text Datetime Ntext Tinyint Decimal Nvarchar Varbinary Float Real Varchar Image Smalldatetime E&DFUDQJEXF&21675$,176 7UQFDFEDQJGOLÊXFDFUDQJEXÔFÔFVGXÊQJQKPFDFPXÊFFKVDX ã 4XLQKFDFJLDWUGOLÊXKD\NKXQGDÊQJGOLÊXÔFFKRSKHSFKÂSQKÊQWUQ FDFFÔWFXDEDQJUDQJEXÔF&+(& ã 4XLQKJLDWUPÊFQKFKRFDFFÔWUDQJEXÔF'()$8/7 WKHRKQKGL\ 1+$19,(1 0$19 +27(1 1*$