{"id":75208,"date":"2024-07-08T17:48:40","date_gmt":"2024-07-08T10:48:40","guid":{"rendered":"https:\/\/itviec.com\/blog\/?p=75208"},"modified":"2025-08-01T14:12:15","modified_gmt":"2025-08-01T07:12:15","slug":"ngon-ngu-dinh-nghia-du-lieu-la-gi","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/","title":{"rendered":"Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u l\u00e0 g\u00ec? C\u00e1c l\u1ec7nh DDL c\u01a1 b\u1ea3n"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#Ngon_ngu_dinh_nghia_du_lieu_la_gi\" >Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u l\u00e0 g\u00ec?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#Cac_lenh_trong_ngon_ngu_dinh_nghia_du_lieu\" >C\u00e1c l\u1ec7nh trong ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#Uu_%E2%80%93_nhuoc_diem_cua_ngon_ngu_dinh_nghia_du_lieu\" >\u01afu &#8211; nh\u01b0\u1ee3c \u0111i\u1ec3m c\u1ee7a ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#Cau_hoi_thuong_gap_ve_ngon_ngu_dinh_nghia_du_lieu\" >C\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#Tong_ket\" >T\u1ed5ng k\u1ebft<\/a><\/li><\/ul><\/nav><\/div>\n\n<p><em><strong>Trong th\u1ebf gi\u1edbi c\u1ee7a c\u01a1 s\u1edf d\u1eef li\u1ec7u, ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u (DDL) \u0111\u00f3ng vai tr\u00f2 trung t\u00e2m v\u00e0 quy\u1ebft \u0111\u1ecbnh trong vi\u1ec7c x\u00e2y d\u1ef1ng v\u00e0 qu\u1ea3n l\u00fd c\u1ea5u tr\u00fac d\u1eef li\u1ec7u. DDL kh\u00f4ng ch\u1ec9 l\u00e0 m\u1ed9t ph\u1ea7n c\u1ee7a SQL m\u00e0 c\u00f2n l\u00e0 c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd cho c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n v\u00e0 qu\u1ea3n tr\u1ecb c\u01a1 s\u1edf d\u1eef li\u1ec7u \u0111\u1ec3 t\u1ea1o, \u0111i\u1ec1u ch\u1ec9nh v\u00e0 x\u00f3a c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng nh\u01b0 b\u1ea3ng, ch\u1ec9 m\u1ee5c v\u00e0 r\u00e0ng bu\u1ed9c. B\u00e0i vi\u1ebft n\u00e0y s\u1ebd d\u1eabn b\u1ea1n kh\u00e1m ph\u00e1 s\u00e2u h\u01a1n v\u1ec1 DDL, v\u1edbi nh\u1eefng l\u1ec7nh quan tr\u1ecdng v\u00e0 t\u1ea7m quan tr\u1ecdng c\u1ee7a n\u00f3 trong vi\u1ec7c \u0111\u1ecbnh h\u00ecnh ki\u1ebfn tr\u00fac d\u1eef li\u1ec7u c\u1ee7a b\u1ea1n.<\/strong><\/em><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">\u0110\u1ecdc b\u00e0i vi\u1ebft n\u00e0y \u0111\u1ec3 hi\u1ec3u v\u1ec1:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400;\">Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u l\u00e0 g\u00ec?<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">C\u00e1c l\u1ec7nh c\u1ee7a ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">\u01afu &#8211; nh\u01b0\u1ee3c \u0111i\u1ec3m c\u1ee7a ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u<\/span><\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Xem th\u00eam\u00a0<strong><a href=\"https:\/\/itviec.com\/viec-lam-it\/data?utm_medium=anchor_text_high&amp;utm_source=blog&amp;utm_campaign=viec_lam_data&amp;utm_content=ngon_ngu_dinh_nghia_du_lieu_la_gi\" target=\"_blank\" rel=\"noreferrer noopener\">vi\u1ec7c l\u00e0m Data<\/a><\/strong>\u00a0ngay tr\u00ean ITviec!<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-ngon-ng\u1eef-d\u1ecbnh-nghia-d\u1eef-li\u1ec7u-la-gi\"><span class=\"ez-toc-section\" id=\"Ngon_ngu_dinh_nghia_du_lieu_la_gi\"><\/span><b>Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u l\u00e0 g\u00ec?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">Ng\u00f4n ng\u1eef \u0110\u1ecbnh ngh\u0129a D\u1eef li\u1ec7u (Data Definition Language &#8211; DDL) l\u00e0 m\u1ed9t t\u1eadp h\u1ee3p con c\u00e1c l\u1ec7nh trong SQL, \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 \u0111\u1ecbnh ngh\u0129a v\u00e0 qu\u1ea3n l\u00fd c\u00e1c c\u1ea5u tr\u00fac d\u1eef li\u1ec7u trong c\u01a1 s\u1edf d\u1eef li\u1ec7u. DDL cung c\u1ea5p c\u00e1c l\u1ec7nh \u0111\u1ec3 \u0111\u1ecbnh ngh\u0129a, s\u1eeda \u0111\u1ed5i ho\u1eb7c x\u00f3a c\u00e1c c\u1ea5u tr\u00fac c\u01a1 s\u1edf d\u1eef li\u1ec7u nh\u01b0 b\u1ea3ng, s\u01a1 \u0111\u1ed3, ch\u1ec9 m\u1ee5c v\u00e0 c\u00e1c r\u00e0ng bu\u1ed9c.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Ch\u1ee9c n\u0103ng ch\u00ednh c\u1ee7a DDL l\u00e0 qu\u1ea3n l\u00fd c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng c\u01a1 s\u1edf d\u1eef li\u1ec7u, t\u1eadp trung v\u00e0o vi\u1ec7c x\u00e2y d\u1ef1ng v\u00e0 duy tr\u00ec c\u1ea5u tr\u00fac t\u1ed5ng th\u1ec3 c\u1ee7a c\u01a1 s\u1edf d\u1eef li\u1ec7u. Khi m\u1ed9t c\u00e2u l\u1ec7nh DDL \u0111\u01b0\u1ee3c th\u1ef1c thi, n\u00f3 s\u1ebd c\u1eadp nh\u1eadt danh m\u1ee5c h\u1ec7 th\u1ed1ng c\u1ee7a c\u01a1 s\u1edf d\u1eef li\u1ec7u &#8211; n\u01a1i l\u01b0u tr\u1eef th\u00f4ng tin v\u1ec1 c\u1ea5u tr\u00fac c\u1ee7a c\u01a1 s\u1edf d\u1eef li\u1ec7u, nh\u01b0ng kh\u00f4ng thay \u0111\u1ed5i d\u1eef li\u1ec7u b\u00ean trong c\u00e1c b\u1ea3ng. C\u00e1c l\u1ec7nh DDL th\u01b0\u1eddng \u0111\u01b0\u1ee3c th\u1ef1c thi trong m\u1ed9t tr\u00ecnh duy\u1ec7t SQL ho\u1eb7c quy tr\u00ecnh l\u01b0u tr\u1eef.<\/span><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u0110\u1ecdc th\u00eam m\u1ed9t s\u1ed1 b\u00e0i vi\u1ebft hay v\u1ec1 c\u01a1 s\u1edf d\u1eef li\u1ec7u:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/itviec.com\/blog\/thiet-ke-co-so-du-lieu-nosql\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Thi\u1ebft k\u1ebf c\u01a1 s\u1edf d\u1eef li\u1ec7u NoSQL: Quy t\u1eafc v\u00e0 c\u00e1c m\u1eabu thi\u1ebft k\u1ebf c\u1ea7n bi\u1ebft<\/strong><\/a><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/itviec.com\/blog\/bao-mat-co-so-du-lieu\/\" target=\"_blank\" rel=\"noreferrer noopener\">B\u1ea3o m\u1eadt c\u01a1 s\u1edf d\u1eef li\u1ec7u: Th\u00e1ch th\u1ee9c v\u00e0 gi\u1ea3i ph\u00e1p<\/a><\/strong><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/itviec.com\/blog\/mariadb-vs-mysql\/\" target=\"_blank\" rel=\"noreferrer noopener\">MariaDB vs MySQL: \u201cCu\u1ed9c chi\u1ebfn\u201d c\u01a1 s\u1edf d\u1eef li\u1ec7u m\u00e3 ngu\u1ed3n m\u1edf<\/a><\/strong><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/itviec.com\/blog\/database-schema-luoc-do-co-so-du-lieu\/\" target=\"_blank\" rel=\"noreferrer noopener\">C\u00e1ch t\u1ed5 ch\u1ee9c l\u01b0\u1ee3c \u0111\u1ed3 c\u01a1 s\u1edf d\u1eef li\u1ec7u t\u1ed1i \u01b0u<\/a><\/strong><\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-l\u1ec7nh-trong-ngon-ng\u1eef-d\u1ecbnh-nghia-d\u1eef-li\u1ec7u\"><span class=\"ez-toc-section\" id=\"Cac_lenh_trong_ngon_ngu_dinh_nghia_du_lieu\"><\/span><b>C\u00e1c l\u1ec7nh trong ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-create\"><b>Create<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">\u0110\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 t\u1ea1o ra c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng m\u1edbi trong c\u01a1 s\u1edf d\u1eef li\u1ec7u. C\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng n\u00e0y c\u00f3 th\u1ec3 bao g\u1ed3m b\u1ea3ng, ch\u1ec9 m\u1ee5c, c\u01a1 s\u1edf d\u1eef li\u1ec7u, s\u01a1 \u0111\u1ed3, ch\u1ebf \u0111\u1ed9 xem (views), th\u1ee7 t\u1ee5c l\u01b0u tr\u1eef v\u00e0 c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng kh\u00e1c.<\/span><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-cu-phap-t\u1ea1o-csdl-m\u1edbi-database\"><strong>C\u00fa ph\u00e1p t\u1ea1o CSDL m\u1edbi (database)<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">CREATE<\/span><span style=\"font-weight: 400;\"> DATABASE database_name;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: \u0111\u1ec3 t\u1ea1o 1 CSDL m\u1edbi \u0111\u1ec3 l\u01b0u tr\u1eef th\u00f4ng tin nh\u00e2n vi\u00ean, ta d\u00f9ng c\u00fa ph\u00e1p sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">CREATE<\/span><span style=\"font-weight: 400;\"> DATABASE Info_Employee;<\/span><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-cu-phap-t\u1ea1o-b\u1ea3ng-m\u1edbi\"><strong>C\u00fa ph\u00e1p t\u1ea1o b\u1ea3ng m\u1edbi<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">CREATE<\/span><span style=\"font-weight: 400;\"> TABLE table_name (&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">column1 datatype <\/span><span style=\"font-weight: 400;\">constraint<\/span><span style=\"font-weight: 400;\">,&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">column2 datatype <\/span><span style=\"font-weight: 400;\">constraint<\/span><span style=\"font-weight: 400;\">,&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">...&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">);<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: \u0110\u1ec3 t\u1ea1o m\u1ed9t b\u1ea3ng m\u1edbi \u0111\u1ec3 l\u01b0u tr\u1eef c\u00e1c th\u00f4ng tin c\u1ee7a nh\u00e2n vi\u00ean nh\u01b0 m\u00e3 nh\u00e2n vi\u00ean, h\u1ecd t\u00ean, ng\u00e0y sinh, v\u1ecb tr\u00ed\u2026. ta d\u00f9ng c\u00fa ph\u00e1p nh\u01b0 sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">CREATE<\/span> <span style=\"font-weight: 400;\">TABLE<\/span><span style=\"font-weight: 400;\"> Employees (&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">EmployeeID <\/span><span style=\"font-weight: 400;\">int<\/span> <span style=\"font-weight: 400;\">PRIMARY<\/span><span style=\"font-weight: 400;\"> KEY,<\/span>\n\n<span style=\"font-weight: 400;\">FirstName <\/span><span style=\"font-weight: 400;\">varchar<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">10<\/span><span style=\"font-weight: 400;\">),&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">LastName <\/span><span style=\"font-weight: 400;\">varchar<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">50<\/span><span style=\"font-weight: 400;\">),&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">BirthDate <\/span><span style=\"font-weight: 400;\">date<\/span><span style=\"font-weight: 400;\">,&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">Position <\/span><span style=\"font-weight: 400;\">varchar<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">50<\/span><span style=\"font-weight: 400;\">)&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">);<\/span><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-cu-phap-t\u1ea1o-ch\u1ec9-m\u1ee5c\"><strong>C\u00fa ph\u00e1p t\u1ea1o ch\u1ec9 m\u1ee5c<\/strong><\/h4>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u1ec7nh n\u00e0y t\u1ea1o ra m\u1ed9t ch\u1ec9 m\u1ee5c cho b\u1ea3ng. Ch\u1ec9 m\u1ee5c l\u00e0 c\u1ea5u tr\u00fac d\u1eef li\u1ec7u gi\u00fap c\u01a1 s\u1edf d\u1eef li\u1ec7u truy c\u1eadp nhanh h\u01a1n \u0111\u1ebfn c\u00e1c h\u00e0ng trong b\u1ea3ng m\u00e0 kh\u00f4ng c\u1ea7n qu\u00e9t to\u00e0n b\u1ed9 b\u1ea3ng.<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">CREATE<\/span><span style=\"font-weight: 400;\"> INDEX index_name&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">ON<\/span><span style=\"font-weight: 400;\"> table_name (column1, column2, ...);<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: \u0110\u1ec3 t\u1ea1o ch\u1ec9 m\u1ee5c tr\u00ean c\u1ed9t FirstName \u0111\u1ec3 t\u1ed1i \u01b0u h\u00f3a vi\u1ec7c t\u00ecm ki\u1ebfm nh\u00e2n vi\u00ean theo t\u00ean, ta s\u1eed d\u1ee5ng c\u00fa ph\u00e1p sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">CREATE<\/span><span style=\"font-weight: 400;\"> INDEX idx_firstname&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">ON<\/span><span style=\"font-weight: 400;\"> Employees (FirstName);<\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-alter\"><b>Alter<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u00e0 l\u1ec7nh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 thay \u0111\u1ed5i c\u1ea5u tr\u00fac c\u1ee7a c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng c\u01a1 s\u1edf d\u1eef li\u1ec7u hi\u1ec7n c\u00f3 ch\u1eb3ng h\u1ea1n nh\u01b0 c\u00e1c th\u00e0nh ph\u1ea7n c\u1ee7a b\u1ea3ng. N\u00f3 cho ph\u00e9p th\u00eam, s\u1eeda \u0111\u1ed5i ho\u1eb7c x\u00f3a c\u00e1c c\u1ed9t v\u00e0 c\u00e1c r\u00e0ng bu\u1ed9c kh\u00e1c trong m\u1ed9t b\u1ea3ng m\u00e0 kh\u00f4ng c\u1ea7n ph\u1ea3i x\u00f3a v\u00e0 t\u1ea1o l\u1ea1i b\u1ea3ng \u0111\u00f3. \u0110\u00e2y l\u00e0 m\u1ed9t c\u00f4ng c\u1ee5 quan tr\u1ecdng gi\u00fap qu\u1ea3n tr\u1ecb vi\u00ean c\u01a1 s\u1edf d\u1eef li\u1ec7u v\u00e0 nh\u00e0 ph\u00e1t tri\u1ec3n d\u1ec5 d\u00e0ng duy tr\u00ec v\u00e0 c\u1eadp nh\u1eadt c\u1ea5u tr\u00fac c\u01a1 s\u1edf d\u1eef li\u1ec7u theo y\u00eau c\u1ea7u thay \u0111\u1ed5i.<\/span><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><span style=\"font-weight: 400;\">Tuy nhi\u00ean, C\u00fa ph\u00e1p c\u1ee7a l\u1ec7nh ALTER c\u00f3 th\u1ec3 kh\u00e1c nhau gi\u1eefa c\u00e1c h\u1ec7 qu\u1ea3n tr\u1ecb c\u01a1 s\u1edf d\u1eef li\u1ec7u (DBMS). <\/span><span style=\"font-weight: 400;\">V\u00ed d\u1ee5, c\u00fa ph\u00e1p c\u1ee7a ALTER trong MySQL c\u00f3 th\u1ec3 kh\u00e1c v\u1edbi c\u00fa ph\u00e1p trong PostgreSQL ho\u1eb7c SQL Server.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ec v\u1eady, khi l\u00e0m vi\u1ec7c v\u1edbi c\u00e1c DBMS kh\u00e1c nhau, h\u00e3y tham kh\u1ea3o t\u00e0i li\u1ec7u c\u1ee7a t\u1eebng h\u1ec7 qu\u1ea3n tr\u1ecb \u0111\u1ec3 bi\u1ebft c\u00fa ph\u00e1p ch\u00ednh x\u00e1c.<\/span><\/p>\n<\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-cu-phap-them-c\u1ed9t-m\u1edbi-ho\u1eb7c-xoa-m\u1ed9t-c\u1ed9t\"><span style=\"font-weight: 400;\"><strong>C\u00fa ph\u00e1p th\u00eam c\u1ed9t m\u1edbi ho\u1eb7c x\u00f3a m\u1ed9t c\u1ed9t<\/strong><\/span><\/h4>\n\n\n\n<p><span style=\"font-weight: 400;\">Ta s\u1eed d\u1ee5ng <\/span><i><span style=\"font-weight: 400;\">ADD<\/span><\/i><span style=\"font-weight: 400;\"> v\u00e0 <\/span><i><span style=\"font-weight: 400;\">DROP<\/span><\/i><span style=\"font-weight: 400;\"> t\u01b0\u01a1ng \u1ee9ng:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">ALTER<\/span><span style=\"font-weight: 400;\"> TABLE table_name&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">ADD<\/span><span style=\"font-weight: 400;\"> column_name datatype;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: \u0111\u1ec3 th\u00eam th\u00f4ng tin Email v\u00e0 c\u1ed9t ManagerID v\u00e0o b\u1ea3ng Employees, ta s\u1eed d\u1ee5ng c\u00fa ph\u00e1p sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">ALTER<\/span><span style=\"font-weight: 400;\"> TABLE Employees<\/span>\n\n<span style=\"font-weight: 400;\">ADD COLUMN<\/span><span style=\"font-weight: 400;\"> ManagerID <\/span><span style=\"font-weight: 400;\">INT<\/span> <span style=\"font-weight: 400;\">NOT NULL<\/span><span style=\"font-weight: 400;\">,&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">ADD<\/span><span style=\"font-weight: 400;\"> Email <\/span><span style=\"font-weight: 400;\">varchar<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">100<\/span><span style=\"font-weight: 400;\">);<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: \u0110\u1ec3 x\u00f3a c\u1ed9t Email trong b\u1ea3ng Employees ta s\u1eed d\u1ee5ng c\u00fa ph\u00e1p sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">ALTER TABLE<\/span><span style=\"font-weight: 400;\"> Employees&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">DROP COLUMN<\/span><span style=\"font-weight: 400;\"> Email;<\/span><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-cu-phap-them-rang-bu\u1ed9c-vao-m\u1ed9t-b\u1ea3ng\"><strong>C\u00fa ph\u00e1p th\u00eam r\u00e0ng bu\u1ed9c v\u00e0o m\u1ed9t b\u1ea3ng<\/strong><\/h4>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">ALTER TABLE<\/span><span style=\"font-weight: 400;\"> table_name&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">ADD CONSTRAINT<\/span><span style=\"font-weight: 400;\"> constraint_name constraint_definition;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: \u0110\u1ec3 th\u00eam kh\u00f3a ngo\u1ea1i (foreign key) \u0111\u1ea3m b\u1ea3o r\u1eb1ng gi\u00e1 tr\u1ecb c\u1ee7a c\u1ed9t ManagerID trong b\u1ea3ng Employees ph\u1ea3i t\u1ed3n t\u1ea1i trong c\u1ed9t EmployeeID c\u1ee7a c\u00f9ng b\u1ea3ng Employees (tr\u01b0\u1eddng h\u1ee3p m\u1ed9t nh\u00e2n vi\u00ean c\u00f3 th\u1ec3 l\u00e0 qu\u1ea3n l\u00fd c\u1ee7a nh\u00e2n vi\u00ean kh\u00e1c), ta s\u1eed d\u1ee5ng c\u00fa ph\u00e1p sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">ALTER TABLE<\/span><span style=\"font-weight: 400;\"> Employees&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">ADD<\/span> <span style=\"font-weight: 400;\">CONSTRAINT<\/span><span style=\"font-weight: 400;\"> FK_Manager <\/span><span style=\"font-weight: 400;\">FOREIGN<\/span><span style=\"font-weight: 400;\"> KEY (ManagerID) <\/span><span style=\"font-weight: 400;\">REFERENCES<\/span><span style=\"font-weight: 400;\"> Employees(EmployeeID);<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: \u0110\u1ec3 th\u00eam r\u00e0ng bu\u1ed9c ki\u1ec3m tra (CHECK constraint) \u0111\u1ea3m b\u1ea3o r\u1eb1ng gi\u00e1 tr\u1ecb c\u1ee7a c\u1ed9t Salary trong b\u1ea3ng Employees l\u1edbn h\u01a1n 0, ta s\u1eed d\u1ee5ng c\u00fa ph\u00e1p sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">ALTER<\/span> <span style=\"font-weight: 400;\">TABLE<\/span><span style=\"font-weight: 400;\"> Employees&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">ADD<\/span><span style=\"font-weight: 400;\"> CONSTRAINT CHK_PositiveSalary <\/span><span style=\"font-weight: 400;\">CHECK<\/span><span style=\"font-weight: 400;\"> (Salary &gt; <\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">);<\/span><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-cu-phap-them-s\u1eeda-d\u1ed5i-ki\u1ec3u-d\u1eef-li\u1ec7u-ho\u1eb7c-cac-rang-bu\u1ed9c-c\u1ee7a-c\u1ed9t-hi\u1ec7n-co\"><span style=\"font-weight: 400;\"><strong>C\u00fa ph\u00e1p th\u00eam s\u1eeda \u0111\u1ed5i ki\u1ec3u d\u1eef li\u1ec7u ho\u1eb7c c\u00e1c r\u00e0ng bu\u1ed9c c\u1ee7a c\u1ed9t hi\u1ec7n c\u00f3<\/strong><\/span><\/h4>\n\n\n\n<p><span style=\"font-weight: 400;\">Ta s\u1eed d\u1ee5ng <\/span><i><span style=\"font-weight: 400;\">MODIFY.<\/span><\/i><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5, \u0111\u1ec3 thay \u0111\u1ed5i ki\u1ec3u d\u1eef li\u1ec7u c\u1ee7a c\u1ed9t FirstName trong b\u1ea3ng Employee, ta s\u1eed d\u1ee5ng c\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">ALTER TABLE<\/span><span style=\"font-weight: 400;\"> Employees&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">MODIFY <\/span><span style=\"font-weight: 400;\">COLUMN<\/span><span style=\"font-weight: 400;\"> FirstName <\/span><span style=\"font-weight: 400;\">varchar<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">50<\/span><span style=\"font-weight: 400;\">);<\/span><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-cu-phap-d\u1ed5i-ten-c\u1ed9t-ho\u1eb7c-ten-b\u1ea3ng\"><span style=\"font-weight: 400;\"><strong>C\u00fa ph\u00e1p \u0111\u1ed5i t\u00ean c\u1ed9t ho\u1eb7c t\u00ean b\u1ea3ng<\/strong><\/span><\/h4>\n\n\n\n<p><span style=\"font-weight: 400;\">Ta s\u1eed d\u1ee5ng <em>RENAME.<\/em><\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5, \u0111\u1ec3 \u0111\u1ed5i t\u00ean c\u1ed9t Position th\u00e0nh JobTitle, ta s\u1eed d\u1ee5ng c\u00fa ph\u00e1p nh\u01b0 sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">ALTER<\/span><span style=\"font-weight: 400;\"> TABLE Employees&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">RENAME <\/span><span style=\"font-weight: 400;\">COLUMN<\/span><span style=\"font-weight: 400;\"> Position <\/span><span style=\"font-weight: 400;\">TO<\/span><span style=\"font-weight: 400;\"> JobTitle;<\/span><b><\/b><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-drop\"><b>DROP<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u00e0 l\u1ec7nh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 x\u00f3a ho\u00e0n to\u00e0n c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng kh\u1ecfi c\u01a1 s\u1edf d\u1eef li\u1ec7u, ch\u1eb3ng h\u1ea1n nh\u01b0 c\u01a1 s\u1edf d\u1eef li\u1ec7u, b\u1ea3ng, ch\u1ec9 m\u1ee5c ho\u1eb7c r\u00e0ng bu\u1ed9c. Khi m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng b\u1ecb x\u00f3a b\u1eb1ng l\u1ec7nh <\/span><i><span style=\"font-weight: 400;\">DROP<\/span><\/i><span style=\"font-weight: 400;\">, t\u1ea5t c\u1ea3 d\u1eef li\u1ec7u b\u00ean trong \u0111\u1ed1i t\u01b0\u1ee3ng \u0111\u00f3 c\u0169ng b\u1ecb x\u00f3a v\u00e0 kh\u00f4ng th\u1ec3 ph\u1ee5c h\u1ed3i l\u1ea1i.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">DROP<\/span><span style=\"font-weight: 400;\"> &lt;database object type&gt; &lt;database object name&gt;;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: \u0110\u1ec3 vi\u1ebft c\u00fa ph\u00e1p xo\u00e1 ho\u00e0n to\u00e0n m\u1ed9t c\u01a1 s\u1edf d\u1eef li\u1ec7u v\u00e0 t\u1ea5t c\u1ea3 c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng b\u00ean trong n\u00f3, ta s\u1eed d\u1ee5ng c\u00fa ph\u00e1p sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">DROP<\/span><span style=\"font-weight: 400;\"> DATABASE Employee_Info;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: \u0111\u1ec3 x\u00f3a b\u1ea3ng Employees, ta s\u1eed d\u1ee5ng c\u00fa ph\u00e1p sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">DROP<\/span> <span style=\"font-weight: 400;\">TABLE<\/span><span style=\"font-weight: 400;\"> Employees;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: \u0111\u1ec3 x\u00f3a r\u00e0ng bu\u1ed9c <\/span><i><span style=\"font-weight: 400;\">CHK_PositiveSalary<\/span><\/i><span style=\"font-weight: 400;\"> tr\u00ean b\u1ea3ng Employees, ta s\u1eed d\u1ee5ng c\u00fa ph\u00e1p sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">ALTER TABLE<\/span><span style=\"font-weight: 400;\"> Employees&nbsp;<\/span>\n\n<span style=\"font-weight: 400;\">DROP<\/span> <span style=\"font-weight: 400;\">CONSTRAINT<\/span><span style=\"font-weight: 400;\"> CHK_PositiveSalary;<\/span><b><\/b><\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Tham kh\u1ea3o\u00a0<strong><a href=\"https:\/\/itviec.com\/viec-lam-it\/database?utm_medium=anchor_text_mid&amp;utm_source=blog&amp;utm_campaign=viec_lam_database&amp;utm_content=ngon_ngu_dinh_nghia_du_lieu_la_gi\" target=\"_blank\" rel=\"noreferrer noopener\">vi\u1ec7c l\u00e0m Database<\/a><\/strong>\u00a0to\u00e0n qu\u1ed1c<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-truncate\"><b>TRUNCATE<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u00e0 l\u1ec7nh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 x\u00f3a to\u00e0n b\u1ed9 d\u1eef li\u1ec7u trong m\u1ed9t b\u1ea3ng m\u00e0 v\u1eabn gi\u1eef l\u1ea1i c\u1ea5u tr\u00fac b\u1ea3ng. Kh\u00e1c v\u1edbi l\u1ec7nh <\/span><i><span style=\"font-weight: 400;\">DROP<\/span><\/i><span style=\"font-weight: 400;\">, l\u1ec7nh <\/span><i><span style=\"font-weight: 400;\">TRUNCATE<\/span><\/i><span style=\"font-weight: 400;\"> ch\u1ec9 x\u00f3a d\u1eef li\u1ec7u m\u00e0 kh\u00f4ng x\u00f3a b\u1ea3ng v\u00e0 c\u00e1c r\u00e0ng bu\u1ed9c, ch\u1ec9 m\u1ee5c li\u00ean quan.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Khi s\u1eed d\u1ee5ng l\u1ec7nh <\/span><i><span style=\"font-weight: 400;\">TRUNCATE<\/span><\/i><span style=\"font-weight: 400;\">, c\u01a1 s\u1edf d\u1eef li\u1ec7u kh\u00f4ng x\u00f3a t\u1eebng h\u00e0ng d\u1eef li\u1ec7u m\u1ed9t, m\u00e0 n\u00f3 \u0111\u00e1nh d\u1ea5u to\u00e0n b\u1ed9 c\u00e1c trang d\u1eef li\u1ec7u (data pages) c\u1ee7a b\u1ea3ng \u0111\u00f3 l\u00e0 tr\u1ed1ng v\u00e0 c\u00f3 s\u1eb5n \u0111\u1ec3 t\u00e1i s\u1eed d\u1ee5ng. \u0110i\u1ec1u n\u00e0y gi\u00fap th\u1ef1c hi\u1ec7n vi\u1ec7c x\u00f3a d\u1eef li\u1ec7u nhanh ch\u00f3ng v\u00e0 hi\u1ec7u qu\u1ea3 h\u01a1n.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:&nbsp;<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">TRUNCATE TABLE<\/span><span style=\"font-weight: 400;\"> &lt;table name&gt;;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5, \u0111\u1ec3 x\u00f3a t\u1ea5t c\u1ea3 c\u00e1c h\u00e0ng trong b\u1ea3ng Employees, ta s\u1eed d\u1ee5ng c\u00fa ph\u00e1p sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">TRUNCATE TABLE<\/span><span style=\"font-weight: 400;\"> Employees;<\/span><\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><em><b>L\u01b0u \u00fd:<\/b> <\/em><i>C\u00fa ph\u00e1p c\u1ee7a c\u00e1c l\u1ec7nh DDL c\u00f3 th\u1ec3 kh\u00e1c nhau gi\u1eefa c\u00e1c h\u1ec7 qu\u1ea3n tr\u1ecb c\u01a1 s\u1edf d\u1eef li\u1ec7u (DBMS) nh\u01b0 MySQL, PostgreSQL, Oracle, SQL Server,&#8230;<\/i><\/p>\n\n\n\n<p><i>B\u00e0i vi\u1ebft n\u00e0y ch\u1ec9 \u0111\u1ec1 c\u1eadp \u0111\u1ebfn c\u00fa ph\u00e1p kh\u00e1i qu\u00e1t v\u00e0 c\u00f3 th\u1ec3 kh\u00f4ng ho\u00e0n to\u00e0n ch\u00ednh x\u00e1c \u0111\u1ed1i v\u1edbi t\u1ea5t c\u1ea3 c\u00e1c DBMS. Khi tri\u1ec3n khai th\u1ef1c t\u1ebf, b\u1ea1n n\u00ean tham kh\u1ea3o t\u00e0i li\u1ec7u c\u1ee7a DBMS c\u1ee5 th\u1ec3 m\u00e0 b\u1ea1n \u0111ang s\u1eed d\u1ee5ng \u0111\u1ec3 \u0111\u1ea3m b\u1ea3o c\u00fa ph\u00e1p ch\u00ednh x\u00e1c.<\/i><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-\u01b0u-nh\u01b0\u1ee3c-di\u1ec3m-c\u1ee7a-ngon-ng\u1eef-d\u1ecbnh-nghia-d\u1eef-li\u1ec7u\"><span class=\"ez-toc-section\" id=\"Uu_%E2%80%93_nhuoc_diem_cua_ngon_ngu_dinh_nghia_du_lieu\"><\/span><b>\u01afu &#8211; nh\u01b0\u1ee3c \u0111i\u1ec3m c\u1ee7a ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><b>\u01afu \u0111i\u1ec3m<\/b><\/td><td><b>Nh\u01b0\u1ee3c \u0111i\u1ec3m<\/b><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">Cho ph\u00e9p thi\u1ebft k\u1ebf v\u00e0 ch\u1ec9nh s\u1eeda c\u1ea5u tr\u00fac c\u01a1 s\u1edf d\u1eef li\u1ec7u m\u1ed9t c\u00e1ch c\u00f3 h\u1ec7 th\u1ed1ng.<\/span><\/td><td><span style=\"font-weight: 400;\">M\u1ed9t s\u1ed1 l\u1ec7nh DDL nh\u01b0 DROP, kh\u00f4ng th\u1ec3 ho\u00e0n t\u00e1c v\u00e0 c\u00f3 th\u1ec3 d\u1eabn \u0111\u1ebfn m\u1ea5t d\u1eef li\u1ec7u.<\/span><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">\u0110\u1ea3m b\u1ea3o s\u1ef1 nh\u1ea5t qu\u00e1n trong \u0111\u1ecbnh ngh\u0129a c\u1ea5u tr\u00fac c\u01a1 s\u1edf d\u1eef li\u1ec7u.<\/span><\/td><td><span style=\"font-weight: 400;\">Khi th\u1ef1c thi m\u1ed9t s\u1ed1 c\u00e2u l\u1ec7nh DDL, \u0111\u1eb7c bi\u1ec7t tr\u00ean t\u1eadp d\u1eef li\u1ec7u l\u1edbn ho\u1eb7c c\u00f3 c\u1ea5u tr\u00fac ph\u1ee9c t\u1ea1p c\u00f3 th\u1ec3 t\u1ed1n nhi\u1ec1u th\u1eddi gian.<\/span><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">DDL cho ph\u00e9p ng\u01b0\u1eddi d\u00f9ng thay \u0111\u1ed5i c\u1ea5u tr\u00fac c\u01a1 s\u1edf d\u1eef li\u1ec7u m\u00e0 kh\u00f4ng \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn d\u1eef li\u1ec7u b\u00ean trong.<\/span><\/td><td><span style=\"font-weight: 400;\">Thay \u0111\u1ed5i c\u1ea5u tr\u00fac b\u1ea3ng c\u00f3 th\u1ec3 d\u1eabn \u0111\u1ebfn l\u1ed7i n\u1ebfu c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng ho\u1eb7c \u1ee9ng d\u1ee5ng kh\u00e1c trong c\u01a1 s\u1edf d\u1eef li\u1ec7u ph\u1ee5 thu\u1ed9c v\u00e0o n\u00f3.<\/span><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cau-h\u1ecfi-th\u01b0\u1eddng-g\u1eb7p-v\u1ec1-ngon-ng\u1eef-d\u1ecbnh-nghia-d\u1eef-li\u1ec7u\"><span class=\"ez-toc-section\" id=\"Cau_hoi_thuong_gap_ve_ngon_ngu_dinh_nghia_du_lieu\"><\/span><b>C\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-cac-cach-s\u1eed-d\u1ee5ng-ddl-la-gi\"><b>C\u00e1c c\u00e1ch s\u1eed d\u1ee5ng DDL l\u00e0 g\u00ec?<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">DDL (Data Definition Language) c\u00f3 nhi\u1ec1u \u1ee9ng d\u1ee5ng quan tr\u1ecdng trong qu\u1ea3n l\u00fd c\u01a1 s\u1edf d\u1eef li\u1ec7u. D\u01b0\u1edbi \u0111\u00e2y l\u00e0 c\u00e1c c\u00e1ch s\u1eed d\u1ee5ng ch\u00ednh c\u1ee7a DDL:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>T\u1ea1o c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng c\u01a1 s\u1edf d\u1eef li\u1ec7u: <\/b><span style=\"font-weight: 400;\">T\u1ea1o b\u1ea3ng, views, ch\u1ec9 m\u1ee5c (indexes) v\u00e0 th\u1ee7 t\u1ee5c l\u01b0u tr\u1eef (stored procedures).<\/span><\/li>\n\n\n\n<li><b>S\u1eeda \u0111\u1ed5i c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng c\u01a1 s\u1edf d\u1eef li\u1ec7u:<\/b><\/li>\n\n\n\n<li>\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400;\">Th\u00eam ho\u1eb7c x\u00f3a c\u1ed9t trong b\u1ea3ng.<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">Thay \u0111\u1ed5i ki\u1ec3u d\u1eef li\u1ec7u c\u1ee7a c\u1ed9t.<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">\u0110\u1ed5i t\u00ean b\u1ea3ng ho\u1eb7c c\u1ed9t.<\/span><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><b>Qu\u1ea3n l\u00fd c\u00e1c r\u00e0ng bu\u1ed9c c\u01a1 s\u1edf d\u1eef li\u1ec7u: <\/b><span style=\"font-weight: 400;\">T\u1ea1o ho\u1eb7c s\u1eeda \u0111\u1ed5i c\u00e1c r\u00e0ng bu\u1ed9c nh\u01b0 kh\u00f3a ch\u00ednh (primary keys), kh\u00f3a ngo\u1ea1i (foreign keys), r\u00e0ng bu\u1ed9c duy nh\u1ea5t (unique constraints) v\u00e0 r\u00e0ng bu\u1ed9c ki\u1ec3m tra (check constraints).<\/span><\/li>\n\n\n\n<li><b>T\u1ea1o ch\u1ec9 m\u1ee5c: <\/b><span style=\"font-weight: 400;\">T\u1ea1o ho\u1eb7c s\u1eeda \u0111\u1ed5i c\u00e1c ch\u1ec9 m\u1ee5c tr\u00ean b\u1ea3ng c\u01a1 s\u1edf d\u1eef li\u1ec7u \u0111\u1ec3 c\u1ea3i thi\u1ec7n hi\u1ec7u su\u1ea5t c\u1ee7a c\u00e1c truy v\u1ea5n SQL.<\/span><\/li>\n\n\n\n<li><b>Ph\u00e2n v\u00f9ng: <\/b><span style=\"font-weight: 400;\">T\u1ea1o ho\u1eb7c s\u1eeda \u0111\u1ed5i c\u00e1c b\u1ea3ng ph\u00e2n v\u00f9ng \u0111\u1ec3 c\u1ea3i thi\u1ec7n hi\u1ec7u su\u1ea5t c\u1ee7a c\u00e1c truy v\u1ea5n truy c\u1eadp l\u01b0\u1ee3ng d\u1eef li\u1ec7u l\u1edbn.<\/span><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-ddl-co-gi-khac-v\u1edbi-dml\"><b>DDL c\u00f3 g\u00ec kh\u00e1c v\u1edbi DML?<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">DDL (Data Definition Language) v\u00e0 DML (Data Manipulation Language) l\u00e0 hai th\u00e0nh ph\u1ea7n c\u1ee7a ng\u00f4n ng\u1eef SQL c\u00f3 m\u1ee5c \u0111\u00edch v\u00e0 ch\u1ee9c n\u0103ng kh\u00e1c nhau trong qu\u1ea3n l\u00fd c\u01a1 s\u1edf d\u1eef li\u1ec7u.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">DDL \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 \u0111\u1ecbnh ngh\u0129a v\u00e0 qu\u1ea3n l\u00fd c\u1ea5u tr\u00fac c\u1ee7a c\u01a1 s\u1edf d\u1eef li\u1ec7u, bao g\u1ed3m c\u00e1c l\u1ec7nh nh\u01b0 CREATE, ALTER, DROP, TRUNCATE, RENAME v\u00e0 COMMENT. Trong khi \u0111\u00f3, DML \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 thao t\u00e1c d\u1eef li\u1ec7u b\u00ean trong c\u00e1c c\u1ea5u tr\u00fac \u0111\u00f3, bao g\u1ed3m c\u00e1c l\u1ec7nh nh\u01b0 SELECT, INSERT, UPDATE v\u00e0 DELETE.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 t\u00ecm hi\u1ec3u s\u00e2u h\u01a1n v\u1ec1 DML l\u00e0 g\u00ec v\u00e0 c\u00e1c l\u1ec7nh DML c\u01a1 b\u1ea3n th\u00f4ng qua b\u00e0i vi\u1ebft v\u1ec1 <a href=\"https:\/\/itviec.com\/blog\/ngon-ngu-thao-tac-du-lieu-la-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>Ng\u00f4n ng\u1eef thao t\u00e1c d\u1eef li\u1ec7u<\/strong><\/a>.<\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-ngoai-cac-l\u1ec7nh-chinh-thi-ddl-con-l\u1ec7nh-nao-khong\"><b>Ngo\u00e0i c\u00e1c l\u1ec7nh ch\u00ednh th\u00ec DDL c\u00f2n l\u1ec7nh n\u00e0o kh\u00f4ng?<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00f3, ngo\u00e0i c\u00e1c l\u1ec7nh ch\u00ednh nh\u01b0 CREATE, ALTER, DROP v\u00e0 TRUNCATE, DDL c\u00f2n bao g\u1ed3m c\u00e1c l\u1ec7nh nh\u01b0 RENAME v\u00e0 COMMENT.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u1ec7nh <strong>RENAME<\/strong> \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 \u0111\u1ed5i t\u00ean b\u1ea3ng ho\u1eb7c c\u1ed9t trong c\u01a1 s\u1edf d\u1eef li\u1ec7u. <\/span><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">RENAME TABLE<\/span><span style=\"font-weight: 400;\"> old_table_name <\/span><span style=\"font-weight: 400;\">TO<\/span><span style=\"font-weight: 400;\"> new_table_name;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u1ec7nh <strong>COMMENT<\/strong> \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 th\u00eam, thay \u0111\u1ed5i ho\u1eb7c x\u00f3a ch\u00fa th\u00edch (comment) cho c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng trong c\u01a1 s\u1edf d\u1eef li\u1ec7u nh\u01b0 b\u1ea3ng, c\u1ed9t. <\/span><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">COMMENT <\/span><span style=\"font-weight: 400;\">ON TABLE<\/span><span style=\"font-weight: 400;\"> table_name <\/span><span style=\"font-weight: 400;\">IS<\/span><span style=\"font-weight: 400;\"> '<\/span><span style=\"font-weight: 400;\">comment_text<\/span><span style=\"font-weight: 400;\">';&nbsp;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">ho\u1eb7c:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">COMMENT <\/span><span style=\"font-weight: 400;\">ON COLUMN<\/span><span style=\"font-weight: 400;\"> table_name.column_name <\/span><span style=\"font-weight: 400;\">IS<\/span><span style=\"font-weight: 400;\">'<\/span><span style=\"font-weight: 400;\">comment_text<\/span><span style=\"font-weight: 400;\">';<\/span><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-t\u1ed5ng-k\u1ebft\"><span class=\"ez-toc-section\" id=\"Tong_ket\"><\/span><b>T\u1ed5ng k\u1ebft<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u (DDL) kh\u00f4ng ch\u1ec9 \u0111\u01a1n gi\u1ea3n l\u00e0 m\u1ed9t ph\u1ea7n c\u1ee7a SQL m\u00e0 c\u00f2n l\u00e0 tr\u1ee5 c\u1ed9t quan tr\u1ecdng trong vi\u1ec7c qu\u1ea3n l\u00fd c\u1ea5u tr\u00fac d\u1eef li\u1ec7u c\u1ee7a m\u1ed9t h\u1ec7 th\u1ed1ng c\u01a1 s\u1edf d\u1eef li\u1ec7u. T\u1eeb vi\u1ec7c \u0111\u1ecbnh ngh\u0129a b\u1ea3ng v\u00e0 ch\u1ec9 m\u1ee5c \u0111\u1ebfn vi\u1ec7c \u00e1p d\u1ee5ng r\u00e0ng bu\u1ed9c d\u1eef li\u1ec7u, DDL cung c\u1ea5p c\u00e1c c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd \u0111\u1ec3 ki\u1ec3m so\u00e1t v\u00e0 b\u1ea3o v\u1ec7 t\u00ednh to\u00e0n v\u1eb9n c\u1ee7a d\u1eef li\u1ec7u.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Qua b\u00e0i vi\u1ebft n\u00e0y, ch\u00fang ta \u0111\u00e3 \u0111\u01b0\u1ee3c chi\u00eam nghi\u1ec7m s\u00e2u h\u01a1n v\u1ec1 vai tr\u00f2 v\u00e0 c\u00e1ch th\u1ee9c ho\u1ea1t \u0111\u1ed9ng c\u1ee7a DDL trong SQL, \u0111\u1ed3ng th\u1eddi nh\u1eadn th\u1ee9c \u0111\u01b0\u1ee3c t\u1ea7m quan tr\u1ecdng c\u1ee7a vi\u1ec7c \u00e1p d\u1ee5ng ch\u00ednh s\u00e1ch qu\u1ea3n l\u00fd d\u1eef li\u1ec7u ch\u1eb7t ch\u1ebd v\u00e0 hi\u1ec7u qu\u1ea3. <\/span><span style=\"font-weight: 400;\">ITviec hy v\u1ecdng b\u00e0i vi\u1ebft tr\u00ean \u0111\u00e3 gi\u00fap b\u1ea1n c\u00f3 c\u00e1i nh\u00ecn t\u1ed5ng quan v\u1ec1 DDL v\u00e0 c\u00e1ch s\u1eed d\u1ee5ng trong c\u00e1c \u1ee9ng d\u1ee5ng c\u1ee5 th\u1ec3.<\/span><\/p>\n\n\n\n<p class=\"has-text-align-center\">B\u1ea1n th\u1ea5y b\u00e0i vi\u1ebft hay v\u00e0 h\u1eefu \u00edch? \u0110\u1eebng ng\u1ea1i Share v\u1edbi b\u1ea1n b\u00e8 v\u00e0 \u0111\u1ed3ng nghi\u1ec7p nh\u00e9.<br>V\u00e0 nhanh tay tham kh\u1ea3o\u00a0<strong><a href=\"https:\/\/itviec.com\/viec-lam-it?utm_medium=anchor_text_low&amp;utm_source=blog&amp;utm_campaign=viec_lam_it&amp;utm_content=ngon_ngu_dinh_nghia_du_lieu_la_gi\" target=\"_blank\" rel=\"noreferrer noopener\">vi\u1ec7c l\u00e0m IT<\/a><\/strong>\u00a0\u201cch\u1ea5t\u201d tr\u00ean ITviec!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Trong th\u1ebf gi\u1edbi c\u1ee7a c\u01a1 s\u1edf d\u1eef li\u1ec7u, ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u (DDL) \u0111\u00f3ng vai tr\u00f2 trung t\u00e2m v\u00e0 quy\u1ebft \u0111\u1ecbnh trong vi\u1ec7c x\u00e2y d\u1ef1ng v\u00e0 qu\u1ea3n l\u00fd c\u1ea5u tr\u00fac d\u1eef li\u1ec7u. DDL kh\u00f4ng ch\u1ec9 l\u00e0 m\u1ed9t ph\u1ea7n c\u1ee7a SQL m\u00e0 c\u00f2n l\u00e0 c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd cho c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n v\u00e0 [&hellip;]<\/p>\n","protected":false},"author":209,"featured_media":75214,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109],"tags":[],"class_list":["post-75208","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u l\u00e0 g\u00ec? C\u00e1c l\u1ec7nh DDL c\u01a1 b\u1ea3n - ITviec Blog<\/title>\n<meta name=\"description\" content=\"Kh\u00e1m ph\u00e1 ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u (DDL) trong SQL: c\u00e1c l\u1ec7nh CREATE, ALTER, DROP, v\u00e0 c\u00e1ch ch\u00fang \u0111\u1ecbnh h\u00ecnh c\u1ea5u tr\u00fac c\u01a1 s\u1edf d\u1eef li\u1ec7u c\u1ee7a b\u1ea1n.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u l\u00e0 g\u00ec? C\u00e1c l\u1ec7nh DDL c\u01a1 b\u1ea3n\" \/>\n<meta property=\"og:description\" content=\"Trong th\u1ebf gi\u1edbi c\u1ee7a c\u01a1 s\u1edf d\u1eef li\u1ec7u, ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u (DDL) \u0111\u00f3ng vai tr\u00f2 trung t\u00e2m v\u00e0 quy\u1ebft \u0111\u1ecbnh trong vi\u1ec7c x\u00e2y d\u1ef1ng v\u00e0 qu\u1ea3n l\u00fd c\u1ea5u tr\u00fac d\u1eef li\u1ec7u.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-08T10:48:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-01T07:12:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/07\/ngon-ngu-dinh-nghia-du-lieu-thumbnail-vippro.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1500\" \/>\n\t<meta property=\"og:image:height\" content=\"790\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"M\u1ef9 Duy\u00ean\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"M\u1ef9 Duy\u00ean\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u l\u00e0 g\u00ec? C\u00e1c l\u1ec7nh DDL c\u01a1 b\u1ea3n - ITviec Blog","description":"Kh\u00e1m ph\u00e1 ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u (DDL) trong SQL: c\u00e1c l\u1ec7nh CREATE, ALTER, DROP, v\u00e0 c\u00e1ch ch\u00fang \u0111\u1ecbnh h\u00ecnh c\u1ea5u tr\u00fac c\u01a1 s\u1edf d\u1eef li\u1ec7u c\u1ee7a b\u1ea1n.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/","og_locale":"vi_VN","og_type":"article","og_title":"Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u l\u00e0 g\u00ec? C\u00e1c l\u1ec7nh DDL c\u01a1 b\u1ea3n","og_description":"Trong th\u1ebf gi\u1edbi c\u1ee7a c\u01a1 s\u1edf d\u1eef li\u1ec7u, ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u (DDL) \u0111\u00f3ng vai tr\u00f2 trung t\u00e2m v\u00e0 quy\u1ebft \u0111\u1ecbnh trong vi\u1ec7c x\u00e2y d\u1ef1ng v\u00e0 qu\u1ea3n l\u00fd c\u1ea5u tr\u00fac d\u1eef li\u1ec7u.","og_url":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2024-07-08T10:48:40+00:00","article_modified_time":"2025-08-01T07:12:15+00:00","og_image":[{"width":1500,"height":790,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/07\/ngon-ngu-dinh-nghia-du-lieu-thumbnail-vippro.jpg","type":"image\/jpeg"}],"author":"M\u1ef9 Duy\u00ean","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"M\u1ef9 Duy\u00ean","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"10 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/"},"author":{"name":"M\u1ef9 Duy\u00ean","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/73733c0725c7e39e696a896bd1abe2d7"},"headline":"Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u l\u00e0 g\u00ec? C\u00e1c l\u1ec7nh DDL c\u01a1 b\u1ea3n","datePublished":"2024-07-08T10:48:40+00:00","dateModified":"2025-08-01T07:12:15+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/"},"wordCount":2937,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/07\/ngon-ngu-dinh-nghia-du-lieu-thumbnail-vippro.jpg","articleSection":["Chuy\u00ean m\u00f4n IT"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/","url":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/","name":"Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u l\u00e0 g\u00ec? C\u00e1c l\u1ec7nh DDL c\u01a1 b\u1ea3n - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/07\/ngon-ngu-dinh-nghia-du-lieu-thumbnail-vippro.jpg","datePublished":"2024-07-08T10:48:40+00:00","dateModified":"2025-08-01T07:12:15+00:00","description":"Kh\u00e1m ph\u00e1 ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u (DDL) trong SQL: c\u00e1c l\u1ec7nh CREATE, ALTER, DROP, v\u00e0 c\u00e1ch ch\u00fang \u0111\u1ecbnh h\u00ecnh c\u1ea5u tr\u00fac c\u01a1 s\u1edf d\u1eef li\u1ec7u c\u1ee7a b\u1ea1n.","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/07\/ngon-ngu-dinh-nghia-du-lieu-thumbnail-vippro.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/07\/ngon-ngu-dinh-nghia-du-lieu-thumbnail-vippro.jpg","width":1500,"height":790,"caption":"ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u ddl - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/ngon-ngu-dinh-nghia-du-lieu-la-gi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"Ng\u00f4n ng\u1eef \u0111\u1ecbnh ngh\u0129a d\u1eef li\u1ec7u l\u00e0 g\u00ec? C\u00e1c l\u1ec7nh DDL c\u01a1 b\u1ea3n"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/73733c0725c7e39e696a896bd1abe2d7","name":"M\u1ef9 Duy\u00ean","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Author_Duyen-Tran-120x120.jpg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Author_Duyen-Tran-120x120.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Author_Duyen-Tran-120x120.jpg","caption":"M\u1ef9 Duy\u00ean"},"url":"https:\/\/itviec.com\/blog\/author\/my-duyen\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/75208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/209"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=75208"}],"version-history":[{"count":2,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/75208\/revisions"}],"predecessor-version":[{"id":90342,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/75208\/revisions\/90342"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/75214"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=75208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=75208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=75208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}