{"id":42253,"date":"2026-06-27T09:52:05","date_gmt":"2026-06-27T02:52:05","guid":{"rendered":"https:\/\/interdata.vn\/blog\/?p=42253"},"modified":"2026-06-27T09:52:05","modified_gmt":"2026-06-27T02:52:05","slug":"trigger-la-gi","status":"publish","type":"post","link":"https:\/\/interdata.vn\/blog\/trigger-la-gi\/","title":{"rendered":"Trigger L\u00e0 G\u00ec? C\u00e1ch D\u00f9ng Trigger Trong SQL B\u1eb1ng V\u00ed D\u1ee5"},"content":{"rendered":"\n\n<style>\n.interdata-plan-carousel,.interdata-plan-carousel *{box-sizing:border-box}\n.interdata-plan-carousel{--blue:#005bea;--blue-dark:#004dcc;--text:#071832;--muted:#516173;--border:#d8e6fb;--bg:#f3f8ff;--shadow:0 5px 14px rgba(0,62,145,.08);container-type:inline-size;background:var(--bg);padding:14px 40px 18px;position:relative;overflow:hidden}\n.interdata-carousel-heading{color:#f00;font-family:Roboto,sans-serif;font-size:18px;line-height:1.35;font-weight:800;text-align:center;margin:0 0 14px}\n.interdata-plan-viewport{overflow:hidden;width:100%}\n.interdata-plan-track{display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;scroll-behavior:smooth;-webkit-overflow-scrolling:touch;scrollbar-width:none;padding:0 0 4px}\n.interdata-plan-track::-webkit-scrollbar{display:none}\n.interdata-plan-card{flex:0 0 calc((100% - 36px)\/4);min-width:0;background:#fff;border:1px solid var(--border);border-radius:8px;padding:15px 10px 13px;min-height:370px;display:flex;flex-direction:column;scroll-snap-align:start;box-shadow:var(--shadow)}\n.interdata-plan-title{color:var(--blue-dark);font-size:16px;line-height:1.22;font-weight:800;text-align:center;margin:0 0 7px;text-transform:uppercase;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.interdata-plan-price{color:var(--blue-dark);font-size:24px;line-height:1;font-weight:900;text-align:center;margin-bottom:12px;white-space:nowrap;letter-spacing:0}\n.interdata-plan-price span{font-size:10px;font-weight:800;margin-left:2px}\n.interdata-plan-badge{align-self:center;display:inline-flex;align-items:center;justify-content:center;background:#ff3934;color:#fff;border-radius:5px;padding:7px 8px;font-size:9px;line-height:1;font-weight:800;margin-bottom:15px;white-space:nowrap;max-width:100%}\n.interdata-plan-features{list-style:none!important;padding:0!important;margin:0!important}\n.interdata-plan-features li{display:flex;gap:7px;align-items:flex-start;color:var(--text);font-size:12px;line-height:1.35;font-weight:700;text-align:left;margin:0 0 10px!important;padding:0!important}\n.interdata-plan-icon{width:14px;min-width:14px;height:14px;color:#0069ff;margin-top:2px}\n.interdata-plan-icon svg{display:block;width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n.interdata-plan-spacer{flex:1;min-height:16px}\n.interdata-plan-button{display:flex;align-items:center;justify-content:center;min-height:42px;width:100%;background:var(--blue);color:#fff!important;border-radius:5px;font-size:13px;font-weight:800;text-decoration:none!important;box-shadow:0 7px 14px rgba(0,91,234,.24);transition:transform .2s ease,background .2s ease}\n.interdata-plan-button:hover{background:var(--blue-dark);color:#fff!important;transform:translateY(-1px)}\n.interdata-carousel-arrow{position:absolute;top:50%;z-index:5;width:44px;height:54px;border:2px solid #fff!important;border-radius:999px;background:var(--blue)!important;color:#fff!important;box-shadow:0 8px 22px rgba(0,62,145,.32);display:flex!important;align-items:center;justify-content:center;cursor:pointer;transform:translateY(-35%);transition:background .2s ease,color .2s ease,opacity .2s ease,transform .2s ease}\n.interdata-carousel-arrow:hover{background:var(--blue-dark)!important;color:#fff!important;transform:translateY(-35%) scale(1.04)}\n.interdata-carousel-arrow:disabled{opacity:.78;cursor:not-allowed;background:#8aa6cf!important;color:#fff!important}\n.interdata-carousel-arrow:disabled:hover{background:#8aa6cf!important;color:#fff!important;transform:translateY(-35%)}\n.interdata-carousel-arrow svg{display:none!important}\n.interdata-carousel-arrow:before{content:none!important;display:none!important}\n.interdata-carousel-mark{display:block!important;color:#fff!important;font-family:Arial,Helvetica,sans-serif!important;font-size:38px!important;font-weight:900!important;line-height:1!important;text-align:center!important;pointer-events:none!important;transform:translateY(-2px)}\n.interdata-carousel-prev{left:14px}\n.interdata-carousel-prev .interdata-carousel-mark{margin-left:-2px}\n.interdata-carousel-next{right:14px}\n.interdata-carousel-next .interdata-carousel-mark{margin-right:-2px}\n@container (max-width:640px){.interdata-plan-carousel{padding:12px 38px 16px}.interdata-plan-card{flex-basis:calc((100% - 12px)\/2);min-height:370px}.interdata-carousel-heading{font-size:16px}}\n@container (max-width:480px){.interdata-plan-carousel{padding:12px 34px 16px}.interdata-plan-card{flex-basis:100%;min-height:360px}.interdata-plan-price{font-size:25px}.interdata-carousel-arrow{width:34px;height:44px}.interdata-carousel-mark{font-size:32px!important}.interdata-carousel-prev{left:5px}.interdata-carousel-next{right:5px}}\n<\/style>\n\n<div class=\"interdata-plan-carousel\" data-interdata-carousel>\n  <div class=\"interdata-carousel-heading\">Si\u00eau \u01afu \u0110\u00e3i VPS \/ CLOUD SERVER - Ti\u1ebft Ki\u1ec7m \u0110\u1ebfn 70%<\/div>\n\n  <svg width=\"0\" height=\"0\" style=\"position:absolute;visibility:hidden\" aria-hidden=\"true\">\n    <symbol id=\"id-icon-cpu\" viewBox=\"0 0 24 24\"><rect x=\"7\" y=\"7\" width=\"10\" height=\"10\" rx=\"2\"><\/rect><path d=\"M4 9h3M4 15h3M17 9h3M17 15h3M9 4v3M15 4v3M9 17v3M15 17v3\"><\/path><path d=\"M10 10h4v4h-4z\"><\/path><\/symbol>\n    <symbol id=\"id-icon-ram\" viewBox=\"0 0 24 24\"><rect x=\"4\" y=\"8\" width=\"16\" height=\"8\" rx=\"2\"><\/rect><path d=\"M7 16v2M11 16v2M15 16v2M19 16v2M7 11h1M11 11h1M15 11h1\"><\/path><\/symbol>\n    <symbol id=\"id-icon-storage\" viewBox=\"0 0 24 24\"><rect x=\"6\" y=\"3\" width=\"12\" height=\"18\" rx=\"2\"><\/rect><path d=\"M9 7h6\"><\/path><circle cx=\"12\" cy=\"16\" r=\"1.5\"><\/circle><\/symbol>\n    <symbol id=\"id-icon-network\" viewBox=\"0 0 24 24\"><path d=\"M5 12.5a10 10 0 0 1 14 0\"><\/path><path d=\"M8.5 16a5 5 0 0 1 7 0\"><\/path><path d=\"M12 19h.01\"><\/path><\/symbol>\n    <symbol id=\"id-icon-gift\" viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"8\" width=\"18\" height=\"13\" rx=\"2\"><\/rect><path d=\"M12 8v13M3 12h18\"><\/path><path d=\"M7.5 8C6.1 8 5 6.9 5 5.5S6.1 3 7.5 3C10 3 12 8 12 8\"><\/path><path d=\"M16.5 8C17.9 8 19 6.9 19 5.5S17.9 3 16.5 3C14 3 12 8 12 8\"><\/path><\/symbol>\n  <\/svg>\n\n  <button class=\"interdata-carousel-arrow interdata-carousel-prev\" type=\"button\" aria-label=\"Xem 4 g\u00f3i tr\u01b0\u1edbc\">\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M15 18l-6-6 6-6\"><\/path><\/svg>\n    <span class=\"interdata-carousel-mark\" aria-hidden=\"true\">&#8249;<\/span>\n  <\/button>\n\n  <div class=\"interdata-plan-viewport\">\n    <div class=\"interdata-plan-track\">\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Premium Base<\/h3>\n        <div class=\"interdata-plan-price\">299K<span>\/3 th\u00e1ng<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>2 vCore Intel<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>2GB <a href=\"https:\/\/interdata.vn\/blog\/ram-server\/\">RAM<\/a><\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>30GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 300Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/best-value-plans-2026\/best-value-plans-premium-base\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Premium Base<\/h3>\n        <div class=\"interdata-plan-price\">999K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>3 vCore Intel<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>3GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>30GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 300Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/cyber-week-2026\/premium-base\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Premium Pro<\/h3>\n        <div class=\"interdata-plan-price\">2.599K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>6 vCore Intel<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>8GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>80GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 350Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/cyber-week-2026\/premium-pro\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Premium Ultra<\/h3>\n        <div class=\"interdata-plan-price\">5.679K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>12 vCore Intel<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>16GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>180GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 450Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/cyber-week-2026\/premium-ultra\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">BD-CLOUD 1<\/h3>\n        <div class=\"interdata-plan-price\">988K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>2 <a href=\"https:\/\/interdata.vn\/blog\/vcpu-la-gi\/\">vCPU<\/a><\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>2 GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>30 GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 300 Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/bd-cloud-performance-2026\/bd-cloud-1\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">BD-CLOUD 2<\/h3>\n        <div class=\"interdata-plan-price\">2.988K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>4 vCPU<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>8 GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>80 GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 300 Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/bd-cloud-performance-2026\/bd-cloud-2\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Cloud-Day - Base<\/h3>\n        <div class=\"interdata-plan-price\">2.666K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-gift\"><\/use><\/svg><\/span>T\u1eb7ng 80GB S3 v\u00e0 1 n\u0103m s\u1eed d\u1ee5ng khi mua 2 n\u0103m tr\u1edf l\u00ean<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>4 vCPU AMD G3<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>6GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>60GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 10Gbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/cloud-day-by-interdata-2026\/cloud-day-base\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Cloud-Day - Pro<\/h3>\n        <div class=\"interdata-plan-price\">5.666K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-gift\"><\/use><\/svg><\/span>T\u1eb7ng 200GB S3 v\u00e0 1 n\u0103m s\u1eed d\u1ee5ng khi mua 2 n\u0103m tr\u1edf l\u00ean<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>8 vCPU AMD G3<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>12GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>160GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 10Gbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/cloud-day-by-interdata-2026\/cloud-day-pro\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n    <\/div>\n  <\/div>\n\n  <button class=\"interdata-carousel-arrow interdata-carousel-next\" type=\"button\" aria-label=\"Xem 4 g\u00f3i ti\u1ebfp theo\">\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M9 18l6-6-6-6\"><\/path><\/svg>\n    <span class=\"interdata-carousel-mark\" aria-hidden=\"true\">&#8250;<\/span>\n  <\/button>\n<\/div>\n\n<script>\n(function(){\n  function setupInterDataCarousel(root){\n    var track=root.querySelector('.interdata-plan-track');\n    var prev=root.querySelector('.interdata-carousel-prev');\n    var next=root.querySelector('.interdata-carousel-next');\n    if(!track||!prev||!next||track.dataset.ready==='1')return;\n    track.dataset.ready='1';\n\n    function pageWidth(){\n      return track.clientWidth;\n    }\n\n    function updateButtons(){\n      var maxScroll=track.scrollWidth-track.clientWidth-2;\n      prev.disabled=track.scrollLeft<=2;\n      next.disabled=track.scrollLeft>=maxScroll;\n    }\n\n    prev.addEventListener('click',function(){\n      track.scrollBy({left:-pageWidth(),behavior:'smooth'});\n    });\n\n    next.addEventListener('click',function(){\n      track.scrollBy({left:pageWidth(),behavior:'smooth'});\n    });\n\n    track.addEventListener('scroll',function(){\n      window.requestAnimationFrame(updateButtons);\n    });\n\n    window.addEventListener('resize',updateButtons);\n    updateButtons();\n  }\n\n  function initInterDataCarousels(){\n    document.querySelectorAll('[data-interdata-carousel]').forEach(setupInterDataCarousel);\n  }\n\n  if(document.readyState==='loading'){\n    document.addEventListener('DOMContentLoaded',initInterDataCarousels);\n  }else{\n    initInterDataCarousels();\n  }\n})();\n<\/script>\n\n\t<div id=\"gap-1938334555\" class=\"gap-element clearfix\" style=\"display:block; height:auto;\">\n\t\t\n<style>\n#gap-1938334555 {\n  padding-top: 30px;\n}\n<\/style>\n\t<\/div>\n\t\n<p style=\"text-align: justify;\"><span style=\"font-size: 100%;\"><strong>Trigger<\/strong> l\u00e0 th\u1ee9 khi\u1ebfn nhi\u1ec1u ng\u01b0\u1eddi m\u1edbi h\u1ecdc Database b\u1ed1i r\u1ed1i: code ch\u1ea1y \u1edf \u0111\u00e2u \u0111\u00f3, d\u1eef li\u1ec7u t\u1ef1 thay \u0111\u1ed5i m\u00e0 kh\u00f4ng th\u1ea5y l\u1ec7nh n\u00e0o g\u1ecdi. N\u1ebfu b\u1ea1n t\u1eebng mu\u1ed1n database t\u1ef1 ghi log, t\u1ef1 c\u1eadp nh\u1eadt t\u1ed3n kho hay t\u1ef1 ki\u1ec3m tra d\u1eef li\u1ec7u tr\u01b0\u1edbc khi l\u01b0u, \u0111\u00e2y ch\u00ednh l\u00e0 c\u00f4ng c\u1ee5 b\u1ea1n c\u1ea7n. B\u00e0i n\u00e0y gi\u1ea3i th\u00edch b\u1ea3n ch\u1ea5t, c\u00fa ph\u00e1p v\u00e0 v\u00ed d\u1ee5 th\u1eadt, k\u00e8m c\u1ea3 nh\u1eefng l\u1ed7i khi\u1ebfn h\u1ec7 th\u1ed1ng ch\u1eadm. N\u1ed9i dung do \u0111\u1ed9i k\u1ef9 thu\u1eadt <a style=\"background: linear-gradient(90deg, #1E3A8A 0%, #2563EB 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-decoration: none; font-weight: bold;\" href=\"https:\/\/interdata.vn\/\">InterData<\/a> bi\u00ean so\u1ea1n.<br \/>\n<\/span><\/p>\n<div style=\"background-color: #eff6ff; padding: 20px; border: 1.5px solid #BFDBFE; border-radius: 12px; margin-bottom: 40px; box-shadow: 0 8px 20px rgba(37, 99, 235, 0.05);\">\n<p style=\"font-family: 'Be Vietnam Pro', sans-serif; font-weight: bold; font-size: 18px; margin-top: 0; margin-bottom: 15px; color: #1e3a8a;\">N\u1ed8I DUNG B\u00c0I VI\u1ebeT<\/p>\n<ul style=\"list-style-type: none; padding-left: 0; margin: 0;\">\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section1\">Trigger trong SQL l\u00e0 g\u00ec v\u00e0 ho\u1ea1t \u0111\u1ed9ng ra sao?<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section2\">C\u00fa ph\u00e1p v\u00e0 c\u00e1ch t\u1ea1o Trigger<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section3\">Ph\u00e2n bi\u1ec7t BEFORE Trigger v\u00e0 AFTER Trigger<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section4\">V\u00ed d\u1ee5 Trigger th\u1ef1c t\u1ebf k\u00e8m code ch\u1ea1y \u0111\u01b0\u1ee3c<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section5\">C\u00e1ch xem, s\u1eeda v\u00e0 x\u00f3a Trigger<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section6\">R\u1ee7i ro khi l\u1ea1m d\u1ee5ng Trigger v\u00e0 c\u00e1ch d\u00f9ng an to\u00e0n<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#section7\">Trigger v\u00e0 h\u1ea1 t\u1ea7ng m\u00e1y ch\u1ee7 ch\u1ea1y database<\/a><\/li>\n<li style=\"margin-bottom: 10px;\"><a style=\"text-decoration: none; color: #2563eb; font-weight: bold;\" href=\"#faq\">C\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Trigger<\/a><\/li>\n<\/ul>\n<\/div>\n<h2 id=\"section1\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin-top: 40px; margin-bottom: 20px; line-height: 1.4;\">Trigger trong SQL l\u00e0 g\u00ec v\u00e0 ho\u1ea1t \u0111\u1ed9ng ra sao?<\/h2>\n<p style=\"text-align: justify;\">Trigger l\u00e0 m\u1ed9t \u0111o\u1ea1n l\u1ec7nh SQL \u0111\u01b0\u1ee3c l\u01b0u trong database v\u00e0 t\u1ef1 \u0111\u1ed9ng ch\u1ea1y khi x\u1ea3y ra m\u1ed9t s\u1ef1 ki\u1ec7n tr\u00ean b\u1ea3ng: INSERT, UPDATE ho\u1eb7c DELETE. B\u1ea1n kh\u00f4ng g\u1ecdi n\u00f3 tr\u1ef1c ti\u1ebfp. Database \u0111\u1ee9ng ra &#8220;l\u1eafng nghe&#8221; s\u1ef1 ki\u1ec7n r\u1ed3i k\u00edch ho\u1ea1t \u0111o\u1ea1n l\u1ec7nh \u0111\u00f3 thay b\u1ea1n.<\/p>\n<p style=\"text-align: justify;\">Hi\u1ec3u \u0111\u01a1n gi\u1ea3n: trigger gi\u1ed1ng m\u1ed9t c\u00e1i b\u1eaby. \u0110\u1eb7t b\u1eaby \u1edf b\u1ea3ng <code>don_hang<\/code>, h\u1ec5 c\u00f3 d\u00f2ng m\u1edbi \u0111\u01b0\u1ee3c ch\u00e8n v\u00e0o l\u00e0 b\u1eaby b\u1eadt. B\u1ea1n quy\u1ebft \u0111\u1ecbnh b\u1eaby l\u00e0m g\u00ec: ghi log, tr\u1eeb t\u1ed3n kho, ch\u1eb7n d\u1eef li\u1ec7u sai.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-42259\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/06\/Trigger-trong-SQL-la-gi-va-cach-hoat-dong.jpg\" alt=\"Trigger trong SQL l\u00e0 g\u00ec v\u00e0 c\u00e1ch ho\u1ea1t \u0111\u1ed9ng\" width=\"700\" height=\"467\" title=\"\" srcset=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/06\/Trigger-trong-SQL-la-gi-va-cach-hoat-dong.jpg 700w, https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/06\/Trigger-trong-SQL-la-gi-va-cach-hoat-dong-300x200.jpg 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">Trigger SQL kh\u00e1c g\u00ec so v\u1edbi g\u1ecdi l\u1ec7nh th\u1ee7 c\u00f4ng<\/h3>\n<p style=\"text-align: justify;\">\u0110i\u1ec3m m\u1ea5u ch\u1ed1t l\u00e0 t\u00ednh t\u1ef1 \u0111\u1ed9ng v\u00e0 t\u00ednh b\u1eaft bu\u1ed9c. Logic n\u1eb1m trong trigger lu\u00f4n ch\u1ea1y, b\u1ea5t k\u1ec3 d\u1eef li\u1ec7u \u0111\u1ebfn t\u1eeb <a href=\"https:\/\/interdata.vn\/blog\/web-application-la-gi\/\">\u1ee9ng d\u1ee5ng web<\/a>, t\u1eeb script import hay t\u1eeb m\u1ed9t c\u00e2u l\u1ec7nh g\u00f5 tay trong console. B\u1ea1n kh\u00f4ng th\u1ec3 &#8220;qu\u00ean&#8221; g\u1ecdi n\u00f3.<\/p>\n<ul style=\"list-style-type: disc; padding-left: 20px; margin-bottom: 25px; color: #1f2937;\">\n<li style=\"margin-bottom: 10px;\"><strong>S\u1ef1 ki\u1ec7n k\u00edch ho\u1ea1t:<\/strong> g\u1eafn v\u1edbi INSERT, UPDATE ho\u1eb7c DELETE tr\u00ean m\u1ed9t b\u1ea3ng c\u1ee5 th\u1ec3.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>Th\u1eddi \u0111i\u1ec3m ch\u1ea1y:<\/strong> BEFORE (tr\u01b0\u1edbc khi ghi) ho\u1eb7c AFTER (sau khi ghi).<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>Ph\u1ea1m vi:<\/strong> ph\u1ed5 bi\u1ebfn nh\u1ea5t l\u00e0 FOR EACH ROW, t\u1ee9c ch\u1ea1y cho t\u1eebng d\u00f2ng b\u1ecb t\u00e1c \u0111\u1ed9ng.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>Truy c\u1eadp d\u1eef li\u1ec7u:<\/strong> d\u00f9ng bi\u1ebfn <code>NEW<\/code> (gi\u00e1 tr\u1ecb m\u1edbi) v\u00e0 <code>OLD<\/code> (gi\u00e1 tr\u1ecb c\u0169) \u0111\u1ec3 \u0111\u1ecdc, so s\u00e1nh ho\u1eb7c ch\u1ec9nh s\u1eeda.<\/li>\n<\/ul>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">Khi n\u00e0o n\u00ean d\u00f9ng trigger<\/h3>\n<p style=\"text-align: justify;\">Trigger h\u1ee3p l\u00fd khi logic ph\u1ea3i \u0111i li\u1ec1n v\u1edbi d\u1eef li\u1ec7u v\u00e0 kh\u00f4ng \u0111\u01b0\u1ee3c b\u1ecf s\u00f3t. V\u00e0i t\u00ecnh hu\u1ed1ng th\u1ef1c t\u1ebf:<\/p>\n<ul style=\"list-style-type: disc; padding-left: 20px; margin-bottom: 25px; color: #1f2937;\">\n<li style=\"margin-bottom: 10px;\">Ghi nh\u1eadt k\u00fd thay \u0111\u1ed5i (audit log) cho b\u1ea3ng quan tr\u1ecdng nh\u01b0 t\u00e0i kho\u1ea3n, \u0111\u01a1n h\u00e0ng.<\/li>\n<li style=\"margin-bottom: 10px;\">T\u1ef1 c\u1eadp nh\u1eadt c\u1ed9t d\u1eabn xu\u1ea5t, v\u00ed d\u1ee5 tr\u1eeb t\u1ed3n kho khi c\u00f3 \u0111\u01a1n m\u1edbi.<\/li>\n<li style=\"margin-bottom: 10px;\">Ki\u1ec3m tra r\u00e0ng bu\u1ed9c ph\u1ee9c t\u1ea1p m\u00e0 CHECK constraint th\u00f4ng th\u01b0\u1eddng kh\u00f4ng di\u1ec5n \u0111\u1ea1t \u0111\u01b0\u1ee3c.<\/li>\n<li style=\"margin-bottom: 10px;\">T\u1ef1 g\u00e1n gi\u00e1 tr\u1ecb m\u1eb7c \u0111\u1ecbnh t\u00ednh to\u00e1n tr\u01b0\u1edbc khi l\u01b0u, nh\u01b0 chu\u1ea9n h\u00f3a email v\u1ec1 ch\u1eef th\u01b0\u1eddng.<\/li>\n<\/ul>\n<h2 id=\"section2\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin-top: 40px; margin-bottom: 20px; line-height: 1.4;\">C\u00fa ph\u00e1p v\u00e0 c\u00e1ch t\u1ea1o Trigger<\/h2>\n<p style=\"text-align: justify;\">C\u1ea5u tr\u00fac m\u1ed9t trigger g\u1ed3m b\u1ed1n ph\u1ea7n: t\u00ean, th\u1eddi \u0111i\u1ec3m, s\u1ef1 ki\u1ec7n v\u00e0 ph\u1ea7n th\u00e2n ch\u1ee9a logic. C\u00fa ph\u00e1p d\u01b0\u1edbi \u0111\u00e2y minh h\u1ecda tr\u00ean MySQL\/MariaDB, h\u1ec7 database ph\u1ed5 bi\u1ebfn nh\u1ea5t v\u1edbi ng\u01b0\u1eddi Vi\u1ec7t khi t\u1ef1 host tr\u00ean <a href=\"https:\/\/interdata.vn\/blog\/vps-la-gi\/\">VPS<\/a>.<\/p>\n<pre>DELIMITER $$\r\n\r\nCREATE TRIGGER ten_trigger\r\n{BEFORE | AFTER} {INSERT | UPDATE | DELETE}\r\nON ten_bang\r\nFOR EACH ROW\r\nBEGIN\r\n    -- logic SQL \u1edf \u0111\u00e2y\r\n    -- d\u00f9ng NEW.cot v\u00e0 OLD.cot \u0111\u1ec3 truy c\u1eadp d\u1eef li\u1ec7u\r\nEND$$\r\n\r\nDELIMITER ;<\/pre>\n<p style=\"text-align: justify;\">V\u00ec sao c\u1ea7n <code>DELIMITER<\/code>? B\u00ean trong th\u00e2n trigger c\u00f3 d\u1ea5u ch\u1ea5m ph\u1ea9y \u1edf m\u1ed7i c\u00e2u l\u1ec7nh. N\u1ebfu kh\u00f4ng \u0111\u1ed5i d\u1ea5u k\u1ebft th\u00fac t\u1ea1m th\u1eddi sang <code>$$<\/code>, MySQL s\u1ebd hi\u1ec3u nh\u1ea7m l\u00e0 trigger k\u1ebft th\u00fac gi\u1eefa ch\u1eebng. \u0110\u00e2y l\u00e0 l\u1ed7i c\u00fa ph\u00e1p g\u1eb7p nhi\u1ec1u nh\u1ea5t khi m\u1edbi t\u1ea1o trigger.<\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">C\u00e1ch t\u1ea1o trigger theo t\u1eebng b\u01b0\u1edbc<\/h3>\n<ol style=\"padding-left: 20px; margin-bottom: 25px; color: #1f2937;\">\n<li style=\"margin-bottom: 10px;\">X\u00e1c \u0111\u1ecbnh b\u1ea3ng v\u00e0 s\u1ef1 ki\u1ec7n c\u1ea7n theo d\u00f5i (INSERT, UPDATE hay DELETE).<\/li>\n<li style=\"margin-bottom: 10px;\">Ch\u1ecdn th\u1eddi \u0111i\u1ec3m: BEFORE n\u1ebfu c\u1ea7n ki\u1ec3m tra ho\u1eb7c s\u1eeda d\u1eef li\u1ec7u tr\u01b0\u1edbc khi ghi; AFTER n\u1ebfu c\u1ea7n ph\u1ea3n \u1ee9ng sau khi ghi xong.<\/li>\n<li style=\"margin-bottom: 10px;\">\u0110\u1eb7t <code>DELIMITER $$<\/code> \u0111\u1ec3 tr\u00e1nh xung \u0111\u1ed9t d\u1ea5u ch\u1ea5m ph\u1ea9y.<\/li>\n<li style=\"margin-bottom: 10px;\">Vi\u1ebft ph\u1ea7n th\u00e2n, d\u00f9ng <code>NEW<\/code> v\u00e0 <code>OLD<\/code> \u0111\u1ec3 thao t\u00e1c d\u1eef li\u1ec7u.<\/li>\n<li style=\"margin-bottom: 10px;\">Tr\u1ea3 <code>DELIMITER<\/code> v\u1ec1 <code>;<\/code> r\u1ed3i ki\u1ec3m th\u1eed tr\u00ean d\u1eef li\u1ec7u m\u1eabu tr\u01b0\u1edbc khi \u0111\u01b0a l\u00ean production.<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">L\u01b0u \u00fd v\u1ec1 bi\u1ebfn NEW v\u00e0 OLD theo lo\u1ea1i s\u1ef1 ki\u1ec7n. V\u1edbi INSERT ch\u1ec9 c\u00f3 <code>NEW<\/code>. V\u1edbi DELETE ch\u1ec9 c\u00f3 <code>OLD<\/code>. V\u1edbi UPDATE c\u00f3 c\u1ea3 hai, cho ph\u00e9p so s\u00e1nh gi\u00e1 tr\u1ecb tr\u01b0\u1edbc v\u00e0 sau. Tham kh\u1ea3o c\u00fa ph\u00e1p chu\u1ea9n t\u1ea1i <a style=\"color: #2563eb; font-weight: 600;\" href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/create-trigger.html\" target=\"_blank\" rel=\"nofollow noopener\">t\u00e0i li\u1ec7u ch\u00ednh th\u1ee9c CREATE TRIGGER c\u1ee7a MySQL<\/a>.<\/p>\n<h2 id=\"section3\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin-top: 40px; margin-bottom: 20px; line-height: 1.4;\">Ph\u00e2n bi\u1ec7t BEFORE Trigger v\u00e0 AFTER Trigger<\/h2>\n<p style=\"text-align: justify;\">Ch\u1ecdn sai th\u1eddi \u0111i\u1ec3m l\u00e0 nguy\u00ean nh\u00e2n khi\u1ebfn nhi\u1ec1u trigger ch\u1ea1y kh\u00f4ng nh\u01b0 mong \u0111\u1ee3i. Quy t\u1eafc g\u1ecdn: BEFORE \u0111\u1ec3 can thi\u1ec7p d\u1eef li\u1ec7u s\u1eafp ghi, AFTER \u0111\u1ec3 ph\u1ea3n \u1ee9ng d\u00e2y chuy\u1ec1n sang b\u1ea3ng kh\u00e1c.<\/p>\n<div style=\"overflow-x: auto;\">\n<table style=\"width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 15px;\">\n<thead>\n<tr style=\"background: #1E3A8A; color: #fff;\">\n<th style=\"padding: 12px; text-align: left; border: 1px solid #BFDBFE;\">Ti\u00eau ch\u00ed<\/th>\n<th style=\"padding: 12px; text-align: left; border: 1px solid #BFDBFE;\">BEFORE Trigger<\/th>\n<th style=\"padding: 12px; text-align: left; border: 1px solid #BFDBFE;\">AFTER Trigger<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\"><strong>Th\u1eddi \u0111i\u1ec3m ch\u1ea1y<\/strong><\/td>\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\">Tr\u01b0\u1edbc khi d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c ghi<\/td>\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\">Sau khi d\u1eef li\u1ec7u \u0111\u00e3 ghi<\/td>\n<\/tr>\n<tr style=\"background: #F8FAFC;\">\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\"><strong>S\u1eeda \u0111\u01b0\u1ee3c NEW kh\u00f4ng<\/strong><\/td>\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\">C\u00f3, g\u00e1n <code>SET NEW.cot = ...<\/code><\/td>\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\">Kh\u00f4ng, d\u1eef li\u1ec7u \u0111\u00e3 c\u1ed1 \u0111\u1ecbnh<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\"><strong>D\u00f9ng \u0111\u1ec3<\/strong><\/td>\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\">Ki\u1ec3m tra, chu\u1ea9n h\u00f3a, ch\u1eb7n d\u1eef li\u1ec7u sai<\/td>\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\">Ghi log, c\u1eadp nh\u1eadt b\u1ea3ng li\u00ean quan<\/td>\n<\/tr>\n<tr style=\"background: #F8FAFC;\">\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\"><strong>R\u1ee7i ro th\u01b0\u1eddng g\u1eb7p<\/strong><\/td>\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\">Logic n\u1eb7ng l\u00e0m ch\u1eadm m\u1ecdi l\u1ea7n ghi<\/td>\n<td style=\"padding: 12px; border: 1px solid #BFDBFE;\">T\u1ea1o ph\u1ea3n \u1ee9ng d\u00e2y chuy\u1ec1n kh\u00f3 l\u1ea7n v\u1ebft<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"text-align: justify;\">M\u1ed9t quy t\u1eafc th\u1ef1c chi\u1ebfn: n\u1ebfu c\u1ea7n thay \u0111\u1ed5i ch\u00ednh d\u00f2ng \u0111ang \u0111\u01b0\u1ee3c ghi, b\u1eaft bu\u1ed9c d\u00f9ng BEFORE. C\u1ed1 g\u00e1n <code>NEW.cot<\/code> trong AFTER s\u1ebd kh\u00f4ng c\u00f3 t\u00e1c d\u1ee5ng v\u00ec d\u1eef li\u1ec7u \u0111\u00e3 n\u1eb1m tr\u00ean \u0111\u0129a.<\/p>\n<div style=\"display: flex; flex-wrap: wrap; background-color: #fff; border: 1.5px solid #BFDBFE; box-shadow: 0 8px 20px rgba(37,99,235,0.08); border-radius: 12px; overflow: hidden; margin: 35px 0;\">\n<div style=\"flex: 1; min-width: 250px; background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%); display: flex; align-items: center; justify-content: center; padding: 30px; text-align: center;\">\n<div>\n<p style=\"color: white; font-size: 34px; font-family: 'Be Vietnam Pro', sans-serif; font-weight: bold; margin: 0; line-height: 1.1;\">Thu\u00ea VPS<\/p>\n<p style=\"color: #dbeafe; font-size: 15px; font-weight: 600; margin-top: 12px;\">To\u00e0n quy\u1ec1n root \u00b7 SSD NVMe U.2 \u00b7 CPU th\u1ebf h\u1ec7 m\u1edbi<\/p>\n<\/div>\n<\/div>\n<div style=\"flex: 2; padding: 25px; min-width: 300px;\">\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 0; font-size: 20px;\">T\u1ef1 host MySQL \u0111\u1ec3 th\u1ef1c h\u00e0nh trigger tho\u1ea3i m\u00e1i<\/h3>\n<p style=\"text-align: justify; font-size: 15px; margin-bottom: 15px;\">Mu\u1ed1n t\u1ea1o, x\u00f3a, debug trigger m\u00e0 kh\u00f4ng b\u1ecb gi\u1edbi h\u1ea1n quy\u1ec1n nh\u01b0 tr\u00ean shared hosting, b\u1ea1n c\u1ea7n m\u1ed9t m\u00f4i tr\u01b0\u1eddng c\u00f3 root. VPS cho ph\u00e9p c\u00e0i MySQL\/MariaDB t\u00f9y phi\u00ean b\u1ea3n, b\u1eadt log \u0111\u1ec3 soi trigger v\u00e0 kh\u00f4i ph\u1ee5c nhanh khi th\u1eed nghi\u1ec7m h\u1ecfng. Ph\u00f9 h\u1ee3p cho dev, sinh vi\u00ean IT v\u00e0 website nh\u1ecf \u0111\u1ebfn v\u1eeba.<\/p>\n<p><a style=\"background: linear-gradient(90deg, #2563EB 0%, #1E3A8A 100%); color: white; padding: 12px 25px; text-decoration: none; font-weight: 600; border-radius: 8px; font-size: 15px; display: inline-block; box-shadow: 0 5px 15px rgba(37,99,235,0.3);\" href=\"https:\/\/interdata.vn\/thue-vps\/\" target=\"_blank\" rel=\"noopener\">Xem c\u1ea5u h\u00ecnh VPS \u27f6<\/a><\/p>\n<\/div>\n<\/div>\n<h2 id=\"section4\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin-top: 40px; margin-bottom: 20px; line-height: 1.4;\">V\u00ed d\u1ee5 Trigger th\u1ef1c t\u1ebf k\u00e8m code ch\u1ea1y \u0111\u01b0\u1ee3c<\/h2>\n<p style=\"text-align: justify;\">L\u00fd thuy\u1ebft \u0111\u1ee7 r\u1ed3i. D\u01b0\u1edbi \u0111\u00e2y l\u00e0 c\u00e1c v\u00ed d\u1ee5 trigger b\u1ea1n c\u00f3 th\u1ec3 ch\u00e9p v\u00e0o MySQL v\u00e0 ch\u1ea1y th\u1eed. M\u1ed7i v\u00ed d\u1ee5 gi\u1ea3i quy\u1ebft m\u1ed9t nhu c\u1ea7u c\u1ee5 th\u1ec3 m\u00e0 \u1ee9ng d\u1ee5ng th\u1eadt hay g\u1eb7p.<\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">V\u00ed d\u1ee5 1: Trigger AFTER INSERT ghi log \u0111\u01a1n h\u00e0ng<\/h3>\n<p style=\"text-align: justify;\">M\u1ed7i khi c\u00f3 \u0111\u01a1n h\u00e0ng m\u1edbi, t\u1ef1 \u0111\u1ed9ng ghi m\u1ed9t d\u00f2ng v\u00e0o b\u1ea3ng nh\u1eadt k\u00fd. D\u00f9ng AFTER v\u00ec ta ph\u1ea3n \u1ee9ng sau khi \u0111\u01a1n \u0111\u00e3 l\u01b0u th\u00e0nh c\u00f4ng.<\/p>\n<pre>DELIMITER $$\r\n\r\nCREATE TRIGGER trg_log_don_hang\r\nAFTER INSERT ON don_hang\r\nFOR EACH ROW\r\nBEGIN\r\n    INSERT INTO nhat_ky_don_hang (don_hang_id, hanh_dong, thoi_gian)\r\n    VALUES (NEW.id, 'TAO_MOI', NOW());\r\nEND$$\r\n\r\nDELIMITER ;<\/pre>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">V\u00ed d\u1ee5 2: Trigger BEFORE UPDATE chu\u1ea9n h\u00f3a v\u00e0 ch\u1eb7n d\u1eef li\u1ec7u sai<\/h3>\n<p style=\"text-align: justify;\">Tr\u01b0\u1edbc khi c\u1eadp nh\u1eadt kh\u00e1ch h\u00e0ng, \u00e9p email v\u1ec1 ch\u1eef th\u01b0\u1eddng v\u00e0 ch\u1eb7n gi\u00e1 tr\u1ecb \u00e2m. D\u00f9ng BEFORE v\u00ec ta c\u1ea7n s\u1eeda <code>NEW<\/code> tr\u01b0\u1edbc khi ghi.<\/p>\n<pre>DELIMITER $$\r\n\r\nCREATE TRIGGER trg_chuan_hoa_khach_hang\r\nBEFORE UPDATE ON khach_hang\r\nFOR EACH ROW\r\nBEGIN\r\n    SET NEW.email = LOWER(NEW.email);\r\n\r\n    IF NEW.diem_thuong &lt; 0 THEN\r\n        SIGNAL SQLSTATE '45000'\r\n        SET MESSAGE_TEXT = 'Diem thuong khong duoc am';\r\n    END IF;\r\nEND$$\r\n\r\nDELIMITER ;<\/pre>\n<p style=\"text-align: justify;\">L\u1ec7nh <code>SIGNAL SQLSTATE '45000'<\/code> l\u00e0 c\u00e1ch chu\u1ea9n \u0111\u1ec3 trigger ch\u1ee7 \u0111\u1ed9ng b\u00e1o l\u1ed7i v\u00e0 h\u1ee7y thao t\u00e1c. C\u1ea3 c\u00e2u UPDATE s\u1ebd b\u1ecb rollback, d\u1eef li\u1ec7u sai kh\u00f4ng l\u1ecdt v\u00e0o.<\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">V\u00ed d\u1ee5 3: Trigger AFTER INSERT tr\u1eeb t\u1ed3n kho<\/h3>\n<p style=\"text-align: justify;\">Khi th\u00eam d\u00f2ng v\u00e0o chi ti\u1ebft \u0111\u01a1n h\u00e0ng, t\u1ef1 tr\u1eeb s\u1ed1 l\u01b0\u1ee3ng t\u1ed3n c\u1ee7a s\u1ea3n ph\u1ea9m t\u01b0\u01a1ng \u1ee9ng. \u0110\u00e2y l\u00e0 ki\u1ec3u logic th\u01b0\u1eddng \u0111\u01b0\u1ee3c v\u00ed nh\u01b0 &#8220;kh\u00f3a ngo\u1ea1i c\u00f3 h\u00e0nh vi&#8221;, gi\u1eef d\u1eef li\u1ec7u gi\u1eefa c\u00e1c b\u1ea3ng nh\u1ea5t qu\u00e1n.<\/p>\n<pre>DELIMITER $$\r\n\r\nCREATE TRIGGER trg_tru_ton_kho\r\nAFTER INSERT ON chi_tiet_don_hang\r\nFOR EACH ROW\r\nBEGIN\r\n    UPDATE san_pham\r\n    SET ton_kho = ton_kho - NEW.so_luong\r\n    WHERE id = NEW.san_pham_id;\r\nEND$$\r\n\r\nDELIMITER ;<\/pre>\n<p style=\"text-align: justify;\">Trigger kh\u00f4ng thay th\u1ebf kh\u00f3a ngo\u1ea1i. Kh\u00f3a ngo\u1ea1i (FOREIGN KEY) gi\u1eef t\u00ednh to\u00e0n v\u1eb9n tham chi\u1ebfu gi\u1eefa c\u00e1c b\u1ea3ng; trigger b\u1ed5 sung h\u00e0nh vi t\u1ef1 \u0111\u1ed9ng khi d\u1eef li\u1ec7u thay \u0111\u1ed5i. Trong th\u1ef1c t\u1ebf b\u1ea1n th\u01b0\u1eddng d\u00f9ng c\u1ea3 hai song song.<\/p>\n<h2 id=\"section5\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin-top: 40px; margin-bottom: 20px; line-height: 1.4;\">C\u00e1ch xem, s\u1eeda v\u00e0 x\u00f3a Trigger<\/h2>\n<p style=\"text-align: justify;\">Trigger l\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng &#8220;v\u00f4 h\u00ecnh&#8221; trong database, kh\u00f4ng hi\u1ec7n ra khi b\u1ea1n nh\u00ecn d\u1eef li\u1ec7u. V\u00ec v\u1eady bi\u1ebft c\u00e1ch li\u1ec7t k\u00ea v\u00e0 qu\u1ea3n l\u00fd ch\u00fang r\u1ea5t quan tr\u1ecdng \u0111\u1ec3 tr\u00e1nh logic \u1ea9n g\u00e2y kh\u00f3 hi\u1ec3u v\u1ec1 sau.<\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">Xem danh s\u00e1ch trigger \u0111ang c\u00f3<\/h3>\n<pre>-- Li\u1ec7t k\u00ea t\u1ea5t c\u1ea3 trigger trong database hi\u1ec7n t\u1ea1i\r\nSHOW TRIGGERS;\r\n\r\n-- Xem chi ti\u1ebft t\u1eeb information_schema\r\nSELECT TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE, ACTION_TIMING\r\nFROM information_schema.TRIGGERS\r\nWHERE TRIGGER_SCHEMA = 'ten_database';<\/pre>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">C\u00e1ch x\u00f3a trigger<\/h3>\n<p style=\"text-align: justify;\">MySQL kh\u00f4ng cho s\u1eeda tr\u1ef1c ti\u1ebfp m\u1ed9t trigger. Mu\u1ed1n \u0111\u1ed5i logic, b\u1ea1n ph\u1ea3i x\u00f3a r\u1ed3i t\u1ea1o l\u1ea1i. D\u00f9ng <code>IF EXISTS<\/code> \u0111\u1ec3 tr\u00e1nh b\u00e1o l\u1ed7i khi trigger kh\u00f4ng t\u1ed3n t\u1ea1i.<\/p>\n<pre>DROP TRIGGER IF EXISTS trg_log_don_hang;<\/pre>\n<ul style=\"list-style-type: disc; padding-left: 20px; margin-bottom: 25px; color: #1f2937;\">\n<li style=\"margin-bottom: 10px;\"><strong>\u0110\u1eb7t t\u00ean nh\u1ea5t qu\u00e1n:<\/strong> d\u00f9ng ti\u1ec1n t\u1ed1 nh\u01b0 <code>trg_<\/code> \u0111\u1ec3 d\u1ec5 nh\u1eadn di\u1ec7n v\u00e0 t\u00ecm.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>L\u01b0u script trigger v\u00e0o version control:<\/strong> \u0111\u1eebng ch\u1ec9 g\u00f5 tr\u1ef1c ti\u1ebfp tr\u00ean server, d\u1ec5 m\u1ea5t d\u1ea5u khi c\u1ea7n kh\u00f4i ph\u1ee5c.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>Ghi ch\u00fa m\u1ee5c \u0111\u00edch:<\/strong> m\u1ed7i trigger n\u00ean c\u00f3 comment gi\u1ea3i th\u00edch n\u00f3 l\u00e0m g\u00ec v\u00e0 v\u00ec sao.<\/li>\n<\/ul>\n<h2 id=\"section6\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin-top: 40px; margin-bottom: 20px; line-height: 1.4;\">R\u1ee7i ro khi l\u1ea1m d\u1ee5ng Trigger v\u00e0 c\u00e1ch d\u00f9ng an to\u00e0n<\/h2>\n<p style=\"text-align: justify;\">Trigger m\u1ea1nh nh\u01b0ng c\u00f3 m\u1eb7t t\u1ed1i. V\u00ec n\u00f3 ch\u1ea1y \u00e2m th\u1ea7m sau m\u1ed7i thao t\u00e1c ghi, l\u1ea1m d\u1ee5ng s\u1ebd bi\u1ebfn database th\u00e0nh h\u1ed9p \u0111en kh\u00f3 debug v\u00e0 l\u00e0m ch\u1eadm h\u1ec7 th\u1ed1ng m\u00e0 kh\u00f4ng ai bi\u1ebft nguy\u00ean nh\u00e2n.<\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">Nh\u1eefng v\u1ea5n \u0111\u1ec1 th\u01b0\u1eddng g\u1eb7p<\/h3>\n<ul style=\"list-style-type: disc; padding-left: 20px; margin-bottom: 25px; color: #1f2937;\">\n<li style=\"margin-bottom: 10px;\"><strong>Ch\u1eadm theo c\u1ea5p s\u1ed1 nh\u00e2n:<\/strong> trigger ch\u1ea1y FOR EACH ROW, n\u00ean m\u1ed9t c\u00e2u UPDATE \u0111\u1ee5ng 10.000 d\u00f2ng s\u1ebd k\u00edch ho\u1ea1t trigger 10.000 l\u1ea7n.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>Trigger l\u1ed3ng nhau:<\/strong> trigger \u1edf b\u1ea3ng A ghi sang b\u1ea3ng B, b\u1ea3ng B l\u1ea1i c\u00f3 trigger ghi sang b\u1ea3ng C. M\u1ed9t thao t\u00e1c nh\u1ecf k\u00e9o theo chu\u1ed7i ph\u1ea3n \u1ee9ng kh\u00f3 l\u1ea7n.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>Logic \u1ea9n:<\/strong> dev m\u1edbi v\u00e0o d\u1ef1 \u00e1n kh\u00f4ng bi\u1ebft d\u1eef li\u1ec7u t\u1ef1 \u0111\u1ed5i v\u00ec c\u00f3 trigger, m\u1ea5t h\u00e0ng gi\u1edd truy l\u1ed7i sai ch\u1ed7.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>Kh\u00f3 kh\u00f4i ph\u1ee5c:<\/strong> n\u1ebfu trigger ghi sai v\u00e0o nhi\u1ec1u b\u1ea3ng, vi\u1ec7c rollback th\u1ee7 c\u00f4ng r\u1ea5t r\u1ee7i ro.<\/li>\n<\/ul>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">Checklist d\u00f9ng trigger an to\u00e0n<\/h3>\n<ul style=\"list-style-type: disc; padding-left: 20px; margin-bottom: 25px; color: #1f2937;\">\n<li style=\"margin-bottom: 10px;\">Gi\u1eef th\u00e2n trigger c\u00e0ng g\u1ecdn c\u00e0ng t\u1ed1t, tr\u00e1nh truy v\u1ea5n n\u1eb7ng hay v\u00f2ng l\u1eb7p.<\/li>\n<li style=\"margin-bottom: 10px;\">Tr\u00e1nh \u0111\u1ec3 trigger g\u1ecdi sang b\u1ea3ng l\u1ea1i c\u00f3 trigger kh\u00e1c, h\u1ea1n ch\u1ebf l\u1ed3ng nhau.<\/li>\n<li style=\"margin-bottom: 10px;\">V\u1edbi x\u1eed l\u00fd h\u00e0ng lo\u1ea1t l\u1edbn, c\u00e2n nh\u1eafc t\u1eaft trigger t\u1ea1m th\u1eddi r\u1ed3i x\u1eed l\u00fd b\u1eb1ng c\u00e2u l\u1ec7nh batch.<\/li>\n<li style=\"margin-bottom: 10px;\">Lu\u00f4n ki\u1ec3m th\u1eed tr\u00ean m\u00f4i tr\u01b0\u1eddng staging v\u00e0 sao l\u01b0u tr\u01b0\u1edbc khi \u0111\u01b0a l\u00ean production.<\/li>\n<li style=\"margin-bottom: 10px;\">N\u1ebfu logic ph\u1ee9c t\u1ea1p, c\u00e2n nh\u1eafc x\u1eed l\u00fd \u1edf t\u1ea7ng \u1ee9ng d\u1ee5ng \u0111\u1ec3 d\u1ec5 ki\u1ec3m so\u00e1t v\u00e0 ghi log h\u01a1n.<\/li>\n<\/ul>\n<h2 id=\"section7\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin-top: 40px; margin-bottom: 20px; line-height: 1.4;\">Trigger v\u00e0 h\u1ea1 t\u1ea7ng m\u00e1y ch\u1ee7 ch\u1ea1y database<\/h2>\n<p style=\"text-align: justify;\">Trigger \u0103n t\u00e0i nguy\u00ean <a href=\"https:\/\/interdata.vn\/blog\/cpu-server\/\">CPU<\/a> v\u00e0 I\/O ngay t\u1ea1i m\u00e1y ch\u1ee7 database. Khi d\u1eef li\u1ec7u c\u00f2n nh\u1ecf, b\u1ea1n kh\u00f3 c\u1ea3m nh\u1eadn. Nh\u01b0ng khi b\u1ea3ng \u0111\u1ea1t h\u00e0ng tri\u1ec7u d\u00f2ng v\u00e0 l\u01b0u l\u01b0\u1ee3ng ghi t\u0103ng, ph\u1ea7n c\u1ee9ng b\u00ean d\u01b0\u1edbi quy\u1ebft \u0111\u1ecbnh trigger ch\u1ea1y m\u01b0\u1ee3t hay ngh\u1ebdn.<\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">V\u00ec sao \u1ed5 \u0111\u0129a v\u00e0 CPU \u1ea3nh h\u01b0\u1edfng t\u1edbi trigger<\/h3>\n<p style=\"text-align: justify;\">M\u1ed7i l\u1ea7n trigger ghi log hay c\u1eadp nh\u1eadt b\u1ea3ng kh\u00e1c \u0111\u1ec1u ph\u00e1t sinh thao t\u00e1c \u0111\u1ecdc\/ghi \u0111\u0129a. \u1ed4 NVMe nhanh h\u01a1n SSD SATA nhi\u1ec1u l\u1ea7n \u1edf c\u00e1c t\u00e1c v\u1ee5 ghi ng\u1eabu nhi\u00ean d\u00e0y \u0111\u1eb7c, \u0111\u00fang ki\u1ec3u workload m\u00e0 trigger t\u1ea1o ra. CPU th\u1ebf h\u1ec7 m\u1edbi gi\u00fap x\u1eed l\u00fd logic trong trigger nhanh h\u01a1n, gi\u1ea3m th\u1eddi gian kh\u00f3a b\u1ea3ng.<\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">Ti\u00eau ch\u00ed ch\u1ecdn m\u00e1y ch\u1ee7 cho database c\u00f3 nhi\u1ec1u trigger<\/h3>\n<ul style=\"list-style-type: disc; padding-left: 20px; margin-bottom: 25px; color: #1f2937;\">\n<li style=\"margin-bottom: 10px;\"><strong>\u1ed4 NVMe:<\/strong> \u01b0u ti\u00ean h\u00e0ng \u0111\u1ea7u cho workload ghi nhi\u1ec1u nh\u01b0 trigger v\u00e0 log.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>RAM \u0111\u1ee7 cho buffer pool:<\/strong> gi\u00fap MySQL gi\u1eef index v\u00e0 d\u1eef li\u1ec7u n\u00f3ng trong b\u1ed9 nh\u1edb, gi\u1ea3m ch\u1ea1m \u0111\u0129a.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>Kh\u1ea3 n\u0103ng n\u00e2ng t\u00e0i nguy\u00ean:<\/strong> khi t\u1ea3i t\u0103ng theo m\u00f9a ho\u1eb7c theo campaign, c\u1ea7n t\u0103ng CPU\/RAM m\u00e0 kh\u00f4ng ph\u1ea3i d\u1ef1ng l\u1ea1i h\u1ec7 th\u1ed1ng.<\/li>\n<li style=\"margin-bottom: 10px;\"><strong>Quy\u1ec1n root:<\/strong> \u0111\u1ec3 tinh ch\u1ec9nh <a href=\"https:\/\/interdata.vn\/blog\/tham-so-parameter-la-gi\/\">tham s\u1ed1<\/a> MySQL, b\u1eadt slow query log v\u00e0 theo d\u00f5i trigger g\u00e2y ch\u1eadm.<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">N\u1ebfu database c\u1ee7a b\u1ea1n c\u00f2n nh\u1ecf v\u00e0 c\u1ea7n m\u00f4i tr\u01b0\u1eddng t\u1ef1 ch\u1ee7 \u0111\u1ec3 h\u1ecdc v\u00e0 v\u1eadn h\u00e0nh, m\u1ed9t VPS c\u00f3 root l\u00e0 \u0111\u1ee7. Khi d\u1eef li\u1ec7u ph\u00ecnh to, l\u01b0u l\u01b0\u1ee3ng ghi bi\u1ebfn \u0111\u1ed9ng m\u1ea1nh ho\u1eb7c nhi\u1ec1u ng\u01b0\u1eddi d\u00f9ng \u0111\u1ed3ng th\u1eddi, \u0111\u00f3 l\u00e0 l\u00fac n\u00ean t\u00ednh t\u1edbi n\u1ec1n t\u1ea3ng c\u00f3 th\u1ec3 scale t\u00e0i nguy\u00ean linh \u0111\u1ed9ng theo t\u1ea3i.<\/p>\n<div style=\"display: flex; flex-wrap: wrap; background-color: #fff; border: 1.5px solid #BFDBFE; box-shadow: 0 8px 20px rgba(37,99,235,0.08); border-radius: 12px; overflow: hidden; margin: 35px 0;\">\n<div style=\"flex: 1; min-width: 250px; background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%); display: flex; align-items: center; justify-content: center; padding: 30px; text-align: center;\">\n<div>\n<p style=\"color: white; font-size: 34px; font-family: 'Be Vietnam Pro', sans-serif; font-weight: bold; margin: 0; line-height: 1.1;\">Cloud Server<\/p>\n<p style=\"color: #dbeafe; font-size: 15px; font-weight: 600; margin-top: 12px;\">Scale t\u00e0i nguy\u00ean theo t\u1ea3i \u00b7 NVMe U.2 \u00b7 H\u1ed7 tr\u1ee3 k\u1ef9 thu\u1eadt 24\/7<\/p>\n<\/div>\n<\/div>\n<div style=\"flex: 2; padding: 25px; min-width: 300px;\">\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 0; font-size: 20px;\">Database l\u1edbn, nhi\u1ec1u trigger, traffic bi\u1ebfn \u0111\u1ed9ng<\/h3>\n<p style=\"text-align: justify; font-size: 15px; margin-bottom: 15px;\">Khi b\u1ea3ng \u0111\u1ea1t h\u00e0ng tri\u1ec7u d\u00f2ng v\u00e0 trigger ph\u00e1t sinh t\u1ea3i ghi n\u1eb7ng v\u00e0o m\u00f9a cao \u0111i\u1ec3m, b\u1ea1n c\u1ea7n kh\u1ea3 n\u0103ng t\u0103ng CPU\/RAM nhanh m\u00e0 kh\u00f4ng gi\u00e1n \u0111o\u1ea1n. Cloud Server ph\u00f9 h\u1ee3p cho h\u1ec7 th\u1ed1ng nhi\u1ec1u ng\u01b0\u1eddi d\u00f9ng, ERP v\u00e0 \u1ee9ng d\u1ee5ng c\u00f3 l\u01b0\u1ee3ng ghi d\u1eef li\u1ec7u l\u1edbn c\u1ea7n m\u1edf r\u1ed9ng theo nhu c\u1ea7u.<\/p>\n<p><a style=\"background: linear-gradient(90deg, #2563EB 0%, #1E3A8A 100%); color: white; padding: 12px 25px; text-decoration: none; font-weight: 600; border-radius: 8px; font-size: 15px; display: inline-block; box-shadow: 0 5px 15px rgba(37,99,235,0.3);\" href=\"https:\/\/interdata.vn\/cloud-server\/\" target=\"_blank\" rel=\"noopener\">T\u00ecm hi\u1ec3u Cloud Server \u27f6<\/a><\/p>\n<\/div>\n<\/div>\n<h2 id=\"faq\" style=\"color: #1e3a8a; font-size: 24px; font-weight: bold; text-align: left; border-left: 5px solid #2563EB; padding-left: 15px; margin-top: 40px; margin-bottom: 20px; line-height: 1.4;\">C\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Trigger<\/h2>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">Trigger SQL l\u00e0 g\u00ec n\u00f3i ng\u1eafn g\u1ecdn?<\/h3>\n<p style=\"text-align: justify;\">L\u00e0 \u0111o\u1ea1n l\u1ec7nh \u0111\u01b0\u1ee3c l\u01b0u trong database v\u00e0 t\u1ef1 ch\u1ea1y khi b\u1ea3ng c\u00f3 s\u1ef1 ki\u1ec7n INSERT, UPDATE ho\u1eb7c DELETE. B\u1ea1n kh\u00f4ng g\u1ecdi n\u00f3 tr\u1ef1c ti\u1ebfp; database t\u1ef1 k\u00edch ho\u1ea1t. N\u00f3 th\u01b0\u1eddng d\u00f9ng \u0111\u1ec3 ghi log, ki\u1ec3m tra d\u1eef li\u1ec7u ho\u1eb7c c\u1eadp nh\u1eadt b\u1ea3ng li\u00ean quan m\u1ed9t c\u00e1ch t\u1ef1 \u0111\u1ed9ng.<\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">M\u1ed9t b\u1ea3ng \u0111\u01b0\u1ee3c ph\u00e9p c\u00f3 bao nhi\u00eau trigger?<\/h3>\n<p style=\"text-align: justify;\">Tr\u00ean MySQL 8.0, m\u1ed9t b\u1ea3ng c\u00f3 th\u1ec3 c\u00f3 nhi\u1ec1u trigger cho c\u00f9ng m\u1ed9t t\u1ed5 h\u1ee3p th\u1eddi \u0111i\u1ec3m v\u00e0 s\u1ef1 ki\u1ec7n, v\u00ed d\u1ee5 nhi\u1ec1u BEFORE INSERT. B\u1ea1n d\u00f9ng m\u1ec7nh \u0111\u1ec1 FOLLOWS ho\u1eb7c PRECEDES \u0111\u1ec3 \u0111\u1ecbnh th\u1ee9 t\u1ef1 ch\u1ea1y. Tuy v\u1eady, c\u00e0ng nhi\u1ec1u trigger c\u00e0ng kh\u00f3 ki\u1ec3m so\u00e1t, n\u00ean gi\u1eef t\u1ed1i thi\u1ec3u.<\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">Trigger c\u00f3 l\u00e0m ch\u1eadm database kh\u00f4ng?<\/h3>\n<p style=\"text-align: justify;\">C\u00f3 th\u1ec3, n\u1ebfu logic n\u1eb7ng ho\u1eb7c ch\u1ea1y tr\u00ean thao t\u00e1c \u0111\u1ee5ng nhi\u1ec1u d\u00f2ng. V\u00ec trigger ch\u1ea1y cho t\u1eebng d\u00f2ng, chi ph\u00ed c\u1ed9ng d\u1ed3n r\u1ea5t nhanh. Gi\u1eef th\u00e2n trigger g\u1ecdn, tr\u00e1nh truy v\u1ea5n n\u1eb7ng v\u00e0 l\u1ed3ng nhau, \u0111\u1ed3ng th\u1eddi ch\u1ea1y tr\u00ean \u1ed5 NVMe \u0111\u1ec3 gi\u1ea3m \u0111\u1ed9 tr\u1ec5 ghi.<\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">C\u00f3 s\u1eeda tr\u1ef1c ti\u1ebfp m\u1ed9t trigger \u0111\u01b0\u1ee3c kh\u00f4ng?<\/h3>\n<p style=\"text-align: justify;\">MySQL kh\u00f4ng h\u1ed7 tr\u1ee3 l\u1ec7nh ALTER TRIGGER. Mu\u1ed1n \u0111\u1ed5i logic, b\u1ea1n x\u00f3a trigger c\u0169 b\u1eb1ng <code>DROP TRIGGER<\/code> r\u1ed3i t\u1ea1o l\u1ea1i b\u1eb1ng <code>CREATE TRIGGER<\/code>. V\u00ec v\u1eady n\u00ean l\u01b0u script trigger trong version control \u0111\u1ec3 kh\u00f4i ph\u1ee5c nhanh khi c\u1ea7n.<\/p>\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; margin-top: 25px; font-size: 20px;\">Khi n\u00e0o n\u00ean d\u00f9ng trigger thay v\u00ec x\u1eed l\u00fd \u1edf \u1ee9ng d\u1ee5ng?<\/h3>\n<p style=\"text-align: justify;\">D\u00f9ng trigger khi logic b\u1eaft bu\u1ed9c ph\u1ea3i ch\u1ea1y b\u1ea5t k\u1ec3 d\u1eef li\u1ec7u \u0111\u1ebfn t\u1eeb \u0111\u00e2u, nh\u01b0 audit log hay r\u00e0ng bu\u1ed9c d\u1eef li\u1ec7u s\u1ed1ng c\u00f2n. N\u1ebfu logic ph\u1ee9c t\u1ea1p, c\u1ea7n ghi log chi ti\u1ebft ho\u1eb7c d\u1ec5 thay \u0111\u1ed5i, x\u1eed l\u00fd \u1edf t\u1ea7ng \u1ee9ng d\u1ee5ng th\u01b0\u1eddng d\u1ec5 b\u1ea3o tr\u00ec v\u00e0 debug h\u01a1n.<\/p>\n<div style=\"border-top: 2px dashed #BFDBFE; margin-top: 50px; padding-top: 30px;\">\n<h3 style=\"font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a8a; font-size: 22px; font-weight: bold; margin-bottom: 15px;\">T\u1ed5ng k\u1ebft: d\u00f9ng Trigger \u0111\u00fang ch\u1ed7, \u0111\u1eebng l\u1ea1m d\u1ee5ng<\/h3>\n<p style=\"text-align: justify;\">Trigger l\u00e0 c\u00f4ng c\u1ee5 t\u1ef1 \u0111\u1ed9ng h\u00f3a SQL \u0111\u00e1ng gi\u00e1 khi b\u1ea1n c\u1ea7n d\u1eef li\u1ec7u t\u1ef1 c\u1eadp nh\u1eadt, t\u1ef1 ghi log ho\u1eb7c t\u1ef1 ki\u1ec3m tra m\u00e0 kh\u00f4ng ph\u1ee5 thu\u1ed9c v\u00e0o vi\u1ec7c \u1ee9ng d\u1ee5ng c\u00f3 g\u1ecdi \u0111\u00fang hay kh\u00f4ng. Ghi nh\u1edb ba \u0111i\u1ec1u: ch\u1ecdn BEFORE \u0111\u1ec3 can thi\u1ec7p d\u1eef li\u1ec7u s\u1eafp ghi v\u00e0 AFTER \u0111\u1ec3 ph\u1ea3n \u1ee9ng sau \u0111\u00f3; gi\u1eef th\u00e2n trigger g\u1ecdn \u0111\u1ec3 tr\u00e1nh l\u00e0m ch\u1eadm h\u1ec7 th\u1ed1ng; lu\u00f4n sao l\u01b0u v\u00e0 ki\u1ec3m th\u1eed tr\u01b0\u1edbc khi \u0111\u01b0a l\u00ean production. Khi database l\u1edbn d\u1ea7n, ph\u1ea7n c\u1ee9ng b\u00ean d\u01b0\u1edbi m\u1edbi l\u00e0 th\u1ee9 quy\u1ebft \u0111\u1ecbnh trigger ch\u1ea1y m\u01b0\u1ee3t.<\/p>\n<div style=\"background: #EFF6FF; border: 1px solid #2563EB; padding: 30px; margin-top: 25px; border-radius: 12px; text-align: center;\">\n<p style=\"font-family: 'Be Vietnam Pro', sans-serif; font-size: 20px; font-weight: bold; color: #1e3a8a; margin-top: 0;\">C\u1ea7n m\u00f4i tr\u01b0\u1eddng t\u1ef1 ch\u1ee7 \u0111\u1ec3 ch\u1ea1y MySQL v\u00e0 trigger?<\/p>\n<p style=\"font-size: 15px; margin-bottom: 20px; color: #4b5563;\">B\u1eaft \u0111\u1ea7u v\u1edbi m\u1ed9t VPS c\u00f3 to\u00e0n quy\u1ec1n root, \u1ed5 NVMe v\u00e0 h\u1ed7 tr\u1ee3 k\u1ef9 thu\u1eadt khi b\u1ea1n c\u1ea7n.<\/p>\n<p><a style=\"background: #2563EB; color: #ffffff; padding: 12px 30px; text-decoration: none; font-weight: 600; border-radius: 6px; display: inline-block;\" href=\"https:\/\/interdata.vn\/thue-vps\/\" target=\"_blank\" rel=\"noopener\">B\u1eaft \u0111\u1ea7u v\u1edbi VPS InterData \u27f6<\/a><\/p>\n<\/div>\n<\/div>\n<p style=\"text-align: justify; font-size: 13px; font-style: italic; color: #6b7280; margin-top: 30px; border-top: 1px solid #E5E7EB; padding-top: 15px;\"><span style=\"font-size: 100%;\"><em>L\u01b0u \u00fd: N\u1ed9i dung v\u00e0 c\u00e1c \u0111o\u1ea1n l\u1ec7nh trong b\u00e0i ch\u1ec9 mang t\u00ednh tham kh\u1ea3o, \u0111\u01b0\u1ee3c minh h\u1ecda ch\u1ee7 y\u1ebfu tr\u00ean MySQL\/MariaDB. C\u00fa ph\u00e1p trigger, bi\u1ebfn NEW\/OLD v\u00e0 c\u00e1ch qu\u1ea3n l\u00fd c\u00f3 th\u1ec3 kh\u00e1c nhau theo h\u1ec7 qu\u1ea3n tr\u1ecb c\u01a1 s\u1edf d\u1eef li\u1ec7u (PostgreSQL, SQL Server, Oracle), phi\u00ean b\u1ea3n ph\u1ea7n m\u1ec1m v\u00e0 m\u00f4i tr\u01b0\u1eddng th\u1ef1c t\u1ebf. B\u1ea1n n\u00ean sao l\u01b0u d\u1eef li\u1ec7u, ki\u1ec3m th\u1eed tr\u00ean m\u00f4i tr\u01b0\u1eddng staging v\u00e0 \u0111\u00e1nh gi\u00e1 r\u1ee7i ro tr\u01b0\u1edbc khi \u00e1p d\u1ee5ng cho production.<\/em><\/span><\/p>\n\n\n<style>\n.interdata-plan-carousel,.interdata-plan-carousel *{box-sizing:border-box}\n.interdata-plan-carousel{--blue:#005bea;--blue-dark:#004dcc;--text:#071832;--muted:#516173;--border:#d8e6fb;--bg:#f3f8ff;--shadow:0 5px 14px rgba(0,62,145,.08);container-type:inline-size;background:var(--bg);padding:14px 40px 18px;position:relative;overflow:hidden}\n.interdata-carousel-heading{color:#f00;font-family:Roboto,sans-serif;font-size:18px;line-height:1.35;font-weight:800;text-align:center;margin:0 0 14px}\n.interdata-plan-viewport{overflow:hidden;width:100%}\n.interdata-plan-track{display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;scroll-behavior:smooth;-webkit-overflow-scrolling:touch;scrollbar-width:none;padding:0 0 4px}\n.interdata-plan-track::-webkit-scrollbar{display:none}\n.interdata-plan-card{flex:0 0 calc((100% - 36px)\/4);min-width:0;background:#fff;border:1px solid var(--border);border-radius:8px;padding:15px 10px 13px;min-height:370px;display:flex;flex-direction:column;scroll-snap-align:start;box-shadow:var(--shadow)}\n.interdata-plan-title{color:var(--blue-dark);font-size:16px;line-height:1.22;font-weight:800;text-align:center;margin:0 0 7px;text-transform:uppercase;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.interdata-plan-price{color:var(--blue-dark);font-size:24px;line-height:1;font-weight:900;text-align:center;margin-bottom:12px;white-space:nowrap;letter-spacing:0}\n.interdata-plan-price span{font-size:10px;font-weight:800;margin-left:2px}\n.interdata-plan-badge{align-self:center;display:inline-flex;align-items:center;justify-content:center;background:#ff3934;color:#fff;border-radius:5px;padding:7px 8px;font-size:9px;line-height:1;font-weight:800;margin-bottom:15px;white-space:nowrap;max-width:100%}\n.interdata-plan-features{list-style:none!important;padding:0!important;margin:0!important}\n.interdata-plan-features li{display:flex;gap:7px;align-items:flex-start;color:var(--text);font-size:12px;line-height:1.35;font-weight:700;text-align:left;margin:0 0 10px!important;padding:0!important}\n.interdata-plan-icon{width:14px;min-width:14px;height:14px;color:#0069ff;margin-top:2px}\n.interdata-plan-icon svg{display:block;width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n.interdata-plan-spacer{flex:1;min-height:16px}\n.interdata-plan-button{display:flex;align-items:center;justify-content:center;min-height:42px;width:100%;background:var(--blue);color:#fff!important;border-radius:5px;font-size:13px;font-weight:800;text-decoration:none!important;box-shadow:0 7px 14px rgba(0,91,234,.24);transition:transform .2s ease,background .2s ease}\n.interdata-plan-button:hover{background:var(--blue-dark);color:#fff!important;transform:translateY(-1px)}\n.interdata-carousel-arrow{position:absolute;top:50%;z-index:5;width:44px;height:54px;border:2px solid #fff!important;border-radius:999px;background:var(--blue)!important;color:#fff!important;box-shadow:0 8px 22px rgba(0,62,145,.32);display:flex!important;align-items:center;justify-content:center;cursor:pointer;transform:translateY(-35%);transition:background .2s ease,color .2s ease,opacity .2s ease,transform .2s ease}\n.interdata-carousel-arrow:hover{background:var(--blue-dark)!important;color:#fff!important;transform:translateY(-35%) scale(1.04)}\n.interdata-carousel-arrow:disabled{opacity:.78;cursor:not-allowed;background:#8aa6cf!important;color:#fff!important}\n.interdata-carousel-arrow:disabled:hover{background:#8aa6cf!important;color:#fff!important;transform:translateY(-35%)}\n.interdata-carousel-arrow svg{display:none!important}\n.interdata-carousel-arrow:before{content:none!important;display:none!important}\n.interdata-carousel-mark{display:block!important;color:#fff!important;font-family:Arial,Helvetica,sans-serif!important;font-size:38px!important;font-weight:900!important;line-height:1!important;text-align:center!important;pointer-events:none!important;transform:translateY(-2px)}\n.interdata-carousel-prev{left:14px}\n.interdata-carousel-prev .interdata-carousel-mark{margin-left:-2px}\n.interdata-carousel-next{right:14px}\n.interdata-carousel-next .interdata-carousel-mark{margin-right:-2px}\n@container (max-width:640px){.interdata-plan-carousel{padding:12px 38px 16px}.interdata-plan-card{flex-basis:calc((100% - 12px)\/2);min-height:370px}.interdata-carousel-heading{font-size:16px}}\n@container (max-width:480px){.interdata-plan-carousel{padding:12px 34px 16px}.interdata-plan-card{flex-basis:100%;min-height:360px}.interdata-plan-price{font-size:25px}.interdata-carousel-arrow{width:34px;height:44px}.interdata-carousel-mark{font-size:32px!important}.interdata-carousel-prev{left:5px}.interdata-carousel-next{right:5px}}\n<\/style>\n\n<div class=\"interdata-plan-carousel\" data-interdata-carousel>\n  <div class=\"interdata-carousel-heading\">Si\u00eau \u01afu \u0110\u00e3i VPS \/ CLOUD SERVER - Ti\u1ebft Ki\u1ec7m \u0110\u1ebfn 70%<\/div>\n\n  <svg width=\"0\" height=\"0\" style=\"position:absolute;visibility:hidden\" aria-hidden=\"true\">\n    <symbol id=\"id-icon-cpu\" viewBox=\"0 0 24 24\"><rect x=\"7\" y=\"7\" width=\"10\" height=\"10\" rx=\"2\"><\/rect><path d=\"M4 9h3M4 15h3M17 9h3M17 15h3M9 4v3M15 4v3M9 17v3M15 17v3\"><\/path><path d=\"M10 10h4v4h-4z\"><\/path><\/symbol>\n    <symbol id=\"id-icon-ram\" viewBox=\"0 0 24 24\"><rect x=\"4\" y=\"8\" width=\"16\" height=\"8\" rx=\"2\"><\/rect><path d=\"M7 16v2M11 16v2M15 16v2M19 16v2M7 11h1M11 11h1M15 11h1\"><\/path><\/symbol>\n    <symbol id=\"id-icon-storage\" viewBox=\"0 0 24 24\"><rect x=\"6\" y=\"3\" width=\"12\" height=\"18\" rx=\"2\"><\/rect><path d=\"M9 7h6\"><\/path><circle cx=\"12\" cy=\"16\" r=\"1.5\"><\/circle><\/symbol>\n    <symbol id=\"id-icon-network\" viewBox=\"0 0 24 24\"><path d=\"M5 12.5a10 10 0 0 1 14 0\"><\/path><path d=\"M8.5 16a5 5 0 0 1 7 0\"><\/path><path d=\"M12 19h.01\"><\/path><\/symbol>\n    <symbol id=\"id-icon-gift\" viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"8\" width=\"18\" height=\"13\" rx=\"2\"><\/rect><path d=\"M12 8v13M3 12h18\"><\/path><path d=\"M7.5 8C6.1 8 5 6.9 5 5.5S6.1 3 7.5 3C10 3 12 8 12 8\"><\/path><path d=\"M16.5 8C17.9 8 19 6.9 19 5.5S17.9 3 16.5 3C14 3 12 8 12 8\"><\/path><\/symbol>\n  <\/svg>\n\n  <button class=\"interdata-carousel-arrow interdata-carousel-prev\" type=\"button\" aria-label=\"Xem 4 g\u00f3i tr\u01b0\u1edbc\">\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M15 18l-6-6 6-6\"><\/path><\/svg>\n    <span class=\"interdata-carousel-mark\" aria-hidden=\"true\">&#8249;<\/span>\n  <\/button>\n\n  <div class=\"interdata-plan-viewport\">\n    <div class=\"interdata-plan-track\">\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Premium Base<\/h3>\n        <div class=\"interdata-plan-price\">299K<span>\/3 th\u00e1ng<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>2 vCore Intel<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>2GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>30GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 300Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/best-value-plans-2026\/best-value-plans-premium-base\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Premium Base<\/h3>\n        <div class=\"interdata-plan-price\">999K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>3 vCore Intel<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>3GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>30GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 300Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/cyber-week-2026\/premium-base\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Premium Pro<\/h3>\n        <div class=\"interdata-plan-price\">2.599K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>6 vCore Intel<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>8GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>80GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 350Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/cyber-week-2026\/premium-pro\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Premium Ultra<\/h3>\n        <div class=\"interdata-plan-price\">5.679K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>12 vCore Intel<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>16GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>180GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 450Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/cyber-week-2026\/premium-ultra\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">BD-CLOUD 1<\/h3>\n        <div class=\"interdata-plan-price\">988K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>2 vCPU<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>2 GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>30 GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 300 Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/bd-cloud-performance-2026\/bd-cloud-1\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">BD-CLOUD 2<\/h3>\n        <div class=\"interdata-plan-price\">2.988K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>4 vCPU<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>8 GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>80 GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 300 Mbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/bd-cloud-performance-2026\/bd-cloud-2\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Cloud-Day - Base<\/h3>\n        <div class=\"interdata-plan-price\">2.666K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-gift\"><\/use><\/svg><\/span>T\u1eb7ng 80GB S3 v\u00e0 1 n\u0103m s\u1eed d\u1ee5ng khi mua 2 n\u0103m tr\u1edf l\u00ean<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>4 vCPU AMD G3<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>6GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>60GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 10Gbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/cloud-day-by-interdata-2026\/cloud-day-base\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n\n      <article class=\"interdata-plan-card\">\n        <h3 class=\"interdata-plan-title\">Cloud-Day - Pro<\/h3>\n        <div class=\"interdata-plan-price\">5.666K<span>\/n\u0103m<\/span><\/div>\n        <div class=\"interdata-plan-badge\">GIA H\u1ea0N KH\u00d4NG \u0110\u1ed4I GI\u00c1<\/div>\n        <ul class=\"interdata-plan-features\">\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-gift\"><\/use><\/svg><\/span>T\u1eb7ng 200GB S3 v\u00e0 1 n\u0103m s\u1eed d\u1ee5ng khi mua 2 n\u0103m tr\u1edf l\u00ean<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-cpu\"><\/use><\/svg><\/span>8 vCPU AMD G3<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-ram\"><\/use><\/svg><\/span>12GB RAM<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-storage\"><\/use><\/svg><\/span>160GB SSD NVMe<\/li>\n          <li><span class=\"interdata-plan-icon\"><svg><use href=\"#id-icon-network\"><\/use><\/svg><\/span>Network: 10Gbps<\/li>\n        <\/ul>\n        <div class=\"interdata-plan-spacer\"><\/div>\n        <a class=\"interdata-plan-button\" href=\"https:\/\/support.interdata.vn\/index.php?rp=\/store\/cloud-day-by-interdata-2026\/cloud-day-pro\" target=\"_blank\" rel=\"nofollow sponsored noopener\">\u0110\u0103ng k\u00fd ngay<\/a>\n      <\/article>\n    <\/div>\n  <\/div>\n\n  <button class=\"interdata-carousel-arrow interdata-carousel-next\" type=\"button\" aria-label=\"Xem 4 g\u00f3i ti\u1ebfp theo\">\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M9 18l6-6-6-6\"><\/path><\/svg>\n    <span class=\"interdata-carousel-mark\" aria-hidden=\"true\">&#8250;<\/span>\n  <\/button>\n<\/div>\n\n<script>\n(function(){\n  function setupInterDataCarousel(root){\n    var track=root.querySelector('.interdata-plan-track');\n    var prev=root.querySelector('.interdata-carousel-prev');\n    var next=root.querySelector('.interdata-carousel-next');\n    if(!track||!prev||!next||track.dataset.ready==='1')return;\n    track.dataset.ready='1';\n\n    function pageWidth(){\n      return track.clientWidth;\n    }\n\n    function updateButtons(){\n      var maxScroll=track.scrollWidth-track.clientWidth-2;\n      prev.disabled=track.scrollLeft<=2;\n      next.disabled=track.scrollLeft>=maxScroll;\n    }\n\n    prev.addEventListener('click',function(){\n      track.scrollBy({left:-pageWidth(),behavior:'smooth'});\n    });\n\n    next.addEventListener('click',function(){\n      track.scrollBy({left:pageWidth(),behavior:'smooth'});\n    });\n\n    track.addEventListener('scroll',function(){\n      window.requestAnimationFrame(updateButtons);\n    });\n\n    window.addEventListener('resize',updateButtons);\n    updateButtons();\n  }\n\n  function initInterDataCarousels(){\n    document.querySelectorAll('[data-interdata-carousel]').forEach(setupInterDataCarousel);\n  }\n\n  if(document.readyState==='loading'){\n    document.addEventListener('DOMContentLoaded',initInterDataCarousels);\n  }else{\n    initInterDataCarousels();\n  }\n})();\n<\/script>\n\n\t<div id=\"gap-305224946\" class=\"gap-element clearfix\" style=\"display:block; height:auto;\">\n\t\t\n<style>\n#gap-305224946 {\n  padding-top: 30px;\n}\n<\/style>\n\t<\/div>\n\t\n","protected":false},"excerpt":{"rendered":"<p>Trigger l\u00e0 th\u1ee9 khi\u1ebfn nhi\u1ec1u ng\u01b0\u1eddi m\u1edbi h\u1ecdc Database b\u1ed1i r\u1ed1i: code ch\u1ea1y \u1edf \u0111\u00e2u \u0111\u00f3, d\u1eef li\u1ec7u t\u1ef1 thay \u0111\u1ed5i m\u00e0 kh\u00f4ng th\u1ea5y l\u1ec7nh n\u00e0o g\u1ecdi. N\u1ebfu b\u1ea1n t\u1eebng mu\u1ed1n database t\u1ef1 ghi log, t\u1ef1 c\u1eadp nh\u1eadt t\u1ed3n kho hay t\u1ef1 ki\u1ec3m tra d\u1eef li\u1ec7u tr\u01b0\u1edbc khi l\u01b0u, \u0111\u00e2y ch\u00ednh l\u00e0 c\u00f4ng c\u1ee5 b\u1ea1n<\/p>\n","protected":false},"author":2,"featured_media":42258,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[140],"tags":[],"class_list":["post-42253","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-lap-trinh"],"_links":{"self":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/42253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/comments?post=42253"}],"version-history":[{"count":5,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/42253\/revisions"}],"predecessor-version":[{"id":42261,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/42253\/revisions\/42261"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/media\/42258"}],"wp:attachment":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/media?parent=42253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/categories?post=42253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/tags?post=42253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}