{"id":3006,"date":"2026-05-09T21:50:59","date_gmt":"2026-05-09T13:50:59","guid":{"rendered":"https:\/\/tekno.bali-island.com\/?p=3006"},"modified":"2026-05-09T21:51:00","modified_gmt":"2026-05-09T13:51:00","slug":"ddl-data-types-keys-and-constraints-in-mysql","status":"publish","type":"post","link":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/","title":{"rendered":"DDL, Data Types, Keys, and Constraints in MySQL"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Introduction to Data Definition Language (DDL)<\/strong><\/h2>\n\n\n\n<p><strong>DDL<\/strong>&nbsp;stands for&nbsp;<em>Data Definition Language<\/em>, which is a set of commands used to describe the overall database design in SQL (<em>Structured Query Language<\/em>). The main commands in DDL include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>CREATE<\/strong>: Used to create new objects.<\/li>\n\n\n\n<li><strong>ALTER<\/strong>: Used to modify the structure of existing objects.<\/li>\n\n\n\n<li><strong>DROP<\/strong>: Used to delete objects.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Using the CREATE, ALTER, and DROP Commands in MySQL<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>a. CREATE<\/strong><\/h3>\n\n\n\n<p>The CREATE command is used to create new databases, new tables, or new&nbsp;<em>views<\/em>.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Example:<\/strong>\u00a0CREATE DATABASE toko_buku;<\/li>\n\n\n\n<li><strong>Explanation:<\/strong>\u00a0This command creates a new database named toko_buku.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>b. ALTER<\/strong><\/h3>\n\n\n\n<p>The ALTER command is used to change the structure of a table that has already been created. This operation can add, delete, modify columns, alter the table, or assign new attributes to columns.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Example:<\/strong>\u00a0ALTER TABLE buku ADD judul_buku varchar(20);<\/li>\n\n\n\n<li><strong>Explanation:<\/strong>\u00a0This command adds a new\u00a0<em>field<\/em>\u00a0(column) named judul_buku with the varchar data type and a maximum length of 20 characters to the buku table.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>c. DROP<\/strong><\/h3>\n\n\n\n<p>The DROP command permanently removes an object from the database. The object can be the database itself, a table, a&nbsp;<em>function<\/em>, an&nbsp;<em>index<\/em>, a&nbsp;<em>procedure<\/em>, a&nbsp;<em>trigger<\/em>, or a&nbsp;<em>view<\/em>.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Example:<\/strong>\u00a0DROP DATABASE toko_buku;<\/li>\n\n\n\n<li><strong>Explanation:<\/strong>\u00a0This command deletes the database named toko_buku.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Data Types in MySQL<\/strong><\/h2>\n\n\n\n<p>Choosing the right data type is very important for database storage efficiency. Below are the categories of data types in MySQL:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>A. Numeric Data Types<\/strong><\/h3>\n\n\n\n<p>Used to store numeric data.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>TINYINT:<\/strong>\u00a0Stores whole numbers (positive\/negative). Range: -128 to 127. Size: 1 byte (8 bits).<\/li>\n\n\n\n<li><strong>SMALLINT:<\/strong>\u00a0Stores whole numbers. Range: -32768 to 32767. Size: 2 bytes (16 bits).<\/li>\n\n\n\n<li><strong>MEDIUMINT:<\/strong>\u00a0Stores whole numbers. Range: -8388608 to 8388607. Size: 3 bytes (24 bits).<\/li>\n\n\n\n<li><strong>INT:<\/strong>\u00a0Stores whole numbers. Range: -2147483648 to 2147483647. Size: 4 bytes (32 bits).<\/li>\n\n\n\n<li><strong>BIGINT:<\/strong>\u00a0Stores large-scale whole numbers. Range: -9223372036854775808 to 9223372036854775807. Size: 8 bytes (64 bits).<\/li>\n\n\n\n<li><strong>FLOAT:<\/strong>\u00a0Stores single-precision floating-point numbers. Size: 4 bytes (32 bits).<\/li>\n\n\n\n<li><strong>DOUBLE \/ REAL:<\/strong>\u00a0Stores double-precision floating-point numbers. Size: 8 bytes (64 bits).<\/li>\n\n\n\n<li><strong>DECIMAL \/ NUMERIC:<\/strong>\u00a0Stores fixed-point numbers with very high precision. Size: 8 bytes (64 bits).<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>B. String Data Types<\/strong><\/h3>\n\n\n\n<p>Used to store character or text data.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>CHAR:<\/strong>\u00a0Stores fixed-length string data (e.g., item ID, national ID number). Range: 0 to 255 characters.<\/li>\n\n\n\n<li><strong>VARCHAR:<\/strong>\u00a0Stores variable-length string data. Range: 0 to 65,535 characters (in the latest versions).<\/li>\n\n\n\n<li><strong>TINYTEXT:<\/strong>\u00a0Stores short text data. Range: 0 to 255 characters.<\/li>\n\n\n\n<li><strong>TEXT:<\/strong>\u00a0Stores standard text data. Range: 0 to 65,535 characters.<\/li>\n\n\n\n<li><strong>MEDIUMTEXT:<\/strong>\u00a0Stores medium-length text data. Range: 0 to 16,777,215 characters.<\/li>\n\n\n\n<li><strong>LONGTEXT:<\/strong>\u00a0Stores very long text data. Range: 0 to 4,294,967,295 characters.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>C. Date and Time Data Types<\/strong><\/h3>\n\n\n\n<p>Used to store date and time data.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>DATE:<\/strong>\u00a0Stores a date (Format: YYYY-MM-DD). Range: &#8216;1000-01-01&#8217; to &#8216;9999-12-31&#8217;. Size: 3 bytes.<\/li>\n\n\n\n<li><strong>TIME:<\/strong>\u00a0Stores a time (Format: HH:MM:SS). Range: &#8216;-838:59:59&#8217; to &#8216;+838:59:59&#8217;. Size: 3 bytes.<\/li>\n\n\n\n<li><strong>DATETIME:<\/strong>\u00a0Combination of date and time (Format: YYYY-MM-DD HH:MM:SS). Range: &#8216;1000-01-01 00:00:00&#8217; to &#8216;9999-12-31 23:59:59&#8217;. Size: 8 bytes.<\/li>\n\n\n\n<li><strong>YEAR:<\/strong>\u00a0Stores a year (Format: YYYY). Range: 1900 to 2155. Size: 1 byte.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>D. BLOB Data Types (Binary)<\/strong><\/h3>\n\n\n\n<p>BLOB stands for&nbsp;<em>Binary Large Object<\/em>. It is used to store pure binary data, is&nbsp;<em>case-sensitive<\/em>, and is ideal for multimedia files such as images, documents, or audio.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>BIT:<\/strong>\u00a0Stores binary data. Range: 64 binary digits.<\/li>\n\n\n\n<li><strong>TINYBLOB:<\/strong>\u00a0Maximum size of 255 bytes.<\/li>\n\n\n\n<li><strong>BLOB:<\/strong>\u00a0Maximum size of 65,535 bytes.<\/li>\n\n\n\n<li><strong>MEDIUMBLOB:<\/strong>\u00a0Maximum size of 16,777,215 bytes.<\/li>\n\n\n\n<li><strong>LONGBLOB:<\/strong>\u00a0Maximum size of 4,294,967,295 bytes.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Types of Keys in SQL<\/strong><\/h2>\n\n\n\n<p>A key in SQL is a combination of one or more attributes (columns) that serves to uniquely distinguish rows of data in a table or to connect (relate) one table with another.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Super Key:<\/strong>\u00a0A set of attributes that can be used to uniquely identify each row of data in a table.<\/li>\n\n\n\n<li><strong>Candidate Key:<\/strong>\u00a0A minimal super key that has no redundant attributes. A candidate key is chosen from the smallest combination of\u00a0<em>fields<\/em>\u00a0capable of identifying unique values.<\/li>\n\n\n\n<li><strong>Primary Key:<\/strong>\u00a0The candidate key selected as the main identifier of a\u00a0<em>record<\/em>. Data in a primary key\u00a0<strong>must not be empty<\/strong>\u00a0(<em>Not Null<\/em>) and\u00a0<strong>must not duplicate<\/strong>. Each table can have only one Primary Key.<\/li>\n\n\n\n<li><strong>Alternate Key:<\/strong>\u00a0A candidate key that is\u00a0<em>not chosen<\/em>\u00a0as the Primary Key.<\/li>\n\n\n\n<li><strong>Foreign Key:<\/strong>\u00a0A key used to relate one table to another, forming a\u00a0<em>parent<\/em>\u00a0and\u00a0<em>child<\/em>\u00a0relationship. The Primary Key in the parent table is referenced by the Foreign Key in the related (child) table.<\/li>\n\n\n\n<li><strong>Composite Key:<\/strong>\u00a0A key consisting of two or more attributes to uniquely identify an entity. Usually used when no single column satisfies the requirements for a Primary Key.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Types of Constraints in MySQL<\/strong><\/h2>\n\n\n\n<p><em>Constraints<\/em>&nbsp;are rules applied to columns or tables to maintain data integrity and validity.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>NOT NULL:<\/strong>\u00a0Ensures that a column cannot be left empty when inserting a\u00a0<em>record<\/em>. The column must be filled with data.<\/li>\n\n\n\n<li><strong>UNIQUE:<\/strong>\u00a0Ensures that every value in a column is different from the others (no duplicate records).<\/li>\n\n\n\n<li><strong>PRIMARY KEY:<\/strong>\u00a0A combination of the NOT NULL and UNIQUE constraints. Uniquely identifies each row in a table. Only one PRIMARY KEY is allowed per table.<\/li>\n\n\n\n<li><strong>FOREIGN KEY:<\/strong>\u00a0Maintains referential integrity between tables. Ensures that the value in the child column has a valid reference in the parent column (in another table).<\/li>\n\n\n\n<li><strong>CHECK:<\/strong>\u00a0Performs validation or checking before data is saved to the database. Data is evaluated with a\u00a0<em>boolean<\/em>\u00a0value; if it meets the condition it is considered\u00a0<em>true<\/em>\u00a0and is stored, but if\u00a0<em>false<\/em>, SQL rejects it and displays an\u00a0<em>error<\/em>\u00a0message.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction to Data Definition Language (DDL) DDL&nbsp;stands for&nbsp;Data Definition Language, which is a set of commands used to describe the overall database design in SQL (Structured Query Language). The main commands in DDL include: Using the CREATE, ALTER, and DROP Commands in MySQL a. CREATE The CREATE command is used to create new databases, new tables, or new&nbsp;views. b. ALTER The ALTER command is used to change the structure of a table that has already been created. This operation can add, delete, modify columns, alter the table, or assign new attributes to columns. c. DROP The DROP command permanently removes an object from the database. The object can be the database itself, a table, a&nbsp;function, an&nbsp;index, a&nbsp;procedure, a&nbsp;trigger, or a&nbsp;view. Data Types in MySQL Choosing the right data type is very important for database storage efficiency. Below are the categories of data types in MySQL: A. Numeric Data Types Used to store numeric data. B. String Data Types Used to store character or text data. C. Date and Time Data Types Used to store date and time data. D. BLOB Data Types (Binary) BLOB stands for&nbsp;Binary Large Object. It is used to store pure binary data, is&nbsp;case-sensitive, and is ideal &hellip;<\/p>\n","protected":false},"author":1,"featured_media":2998,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[93],"tags":[],"class_list":["post-3006","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>DDL, Data Types, Keys, and Constraints in MySQL<\/title>\n<meta name=\"description\" content=\"Discusses the definition of DDL (CREATE, ALTER, DROP), data types, key types, and database constraints for beginners.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DDL, Data Types, Keys, and Constraints in MySQL\" \/>\n<meta property=\"og:description\" content=\"Discusses the definition of DDL (CREATE, ALTER, DROP), data types, key types, and database constraints for beginners.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/\" \/>\n<meta property=\"og:site_name\" content=\"Bali Island Tekno\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/people\/Wilanpedia\/61575048527927\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-05-09T13:50:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-09T13:51:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/tekno.bali-island.com\/wp-content\/uploads\/2026\/05\/DDL.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Wilan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Wilan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/\"},\"author\":{\"name\":\"Wilan\",\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/#\\\/schema\\\/person\\\/945426dbaeb9dc9d603797b51b1b7e42\"},\"headline\":\"DDL, Data Types, Keys, and Constraints in MySQL\",\"datePublished\":\"2026-05-09T13:50:59+00:00\",\"dateModified\":\"2026-05-09T13:51:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/\"},\"wordCount\":892,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/tekno.bali-island.com\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/DDL.webp\",\"articleSection\":[\"Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/\",\"url\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/\",\"name\":\"DDL, Data Types, Keys, and Constraints in MySQL\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/tekno.bali-island.com\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/DDL.webp\",\"datePublished\":\"2026-05-09T13:50:59+00:00\",\"dateModified\":\"2026-05-09T13:51:00+00:00\",\"description\":\"Discusses the definition of DDL (CREATE, ALTER, DROP), data types, key types, and database constraints for beginners.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/#primaryimage\",\"url\":\"https:\\\/\\\/tekno.bali-island.com\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/DDL.webp\",\"contentUrl\":\"https:\\\/\\\/tekno.bali-island.com\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/DDL.webp\",\"width\":1920,\"height\":1080,\"caption\":\"DDL\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/articles\\\/ddl-data-types-keys-and-constraints-in-mysql\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DDL, Data Types, Keys, and Constraints in MySQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/\",\"name\":\"Bali Island Tekno\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/#organization\",\"name\":\"Bali Island Tekno\",\"url\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/tekno.bali-island.com\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/Logo-Tekno-Bali-Island.webp\",\"contentUrl\":\"https:\\\/\\\/tekno.bali-island.com\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/Logo-Tekno-Bali-Island.webp\",\"width\":512,\"height\":512,\"caption\":\"Bali Island Tekno\"},\"image\":{\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/people\\\/Wilanpedia\\\/61575048527927\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/tekno.bali-island.com\\\/en\\\/#\\\/schema\\\/person\\\/945426dbaeb9dc9d603797b51b1b7e42\",\"name\":\"Wilan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b88f244258181b0b6313e5bf915a4aa9f133283d33124cb16947eb1389dc4bc5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b88f244258181b0b6313e5bf915a4aa9f133283d33124cb16947eb1389dc4bc5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b88f244258181b0b6313e5bf915a4aa9f133283d33124cb16947eb1389dc4bc5?s=96&d=mm&r=g\",\"caption\":\"Wilan\"},\"sameAs\":[\"https:\\\/\\\/tekno.bali-island.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DDL, Data Types, Keys, and Constraints in MySQL","description":"Discusses the definition of DDL (CREATE, ALTER, DROP), data types, key types, and database constraints for beginners.","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:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/","og_locale":"en_US","og_type":"article","og_title":"DDL, Data Types, Keys, and Constraints in MySQL","og_description":"Discusses the definition of DDL (CREATE, ALTER, DROP), data types, key types, and database constraints for beginners.","og_url":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/","og_site_name":"Bali Island Tekno","article_publisher":"https:\/\/www.facebook.com\/people\/Wilanpedia\/61575048527927\/","article_published_time":"2026-05-09T13:50:59+00:00","article_modified_time":"2026-05-09T13:51:00+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/tekno.bali-island.com\/wp-content\/uploads\/2026\/05\/DDL.webp","type":"image\/webp"}],"author":"Wilan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Wilan","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/#article","isPartOf":{"@id":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/"},"author":{"name":"Wilan","@id":"https:\/\/tekno.bali-island.com\/en\/#\/schema\/person\/945426dbaeb9dc9d603797b51b1b7e42"},"headline":"DDL, Data Types, Keys, and Constraints in MySQL","datePublished":"2026-05-09T13:50:59+00:00","dateModified":"2026-05-09T13:51:00+00:00","mainEntityOfPage":{"@id":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/"},"wordCount":892,"commentCount":0,"publisher":{"@id":"https:\/\/tekno.bali-island.com\/en\/#organization"},"image":{"@id":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/tekno.bali-island.com\/wp-content\/uploads\/2026\/05\/DDL.webp","articleSection":["Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/","url":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/","name":"DDL, Data Types, Keys, and Constraints in MySQL","isPartOf":{"@id":"https:\/\/tekno.bali-island.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/#primaryimage"},"image":{"@id":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/tekno.bali-island.com\/wp-content\/uploads\/2026\/05\/DDL.webp","datePublished":"2026-05-09T13:50:59+00:00","dateModified":"2026-05-09T13:51:00+00:00","description":"Discusses the definition of DDL (CREATE, ALTER, DROP), data types, key types, and database constraints for beginners.","breadcrumb":{"@id":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/#primaryimage","url":"https:\/\/tekno.bali-island.com\/wp-content\/uploads\/2026\/05\/DDL.webp","contentUrl":"https:\/\/tekno.bali-island.com\/wp-content\/uploads\/2026\/05\/DDL.webp","width":1920,"height":1080,"caption":"DDL"},{"@type":"BreadcrumbList","@id":"https:\/\/tekno.bali-island.com\/en\/articles\/ddl-data-types-keys-and-constraints-in-mysql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tekno.bali-island.com\/en\/"},{"@type":"ListItem","position":2,"name":"DDL, Data Types, Keys, and Constraints in MySQL"}]},{"@type":"WebSite","@id":"https:\/\/tekno.bali-island.com\/en\/#website","url":"https:\/\/tekno.bali-island.com\/en\/","name":"Bali Island Tekno","description":"","publisher":{"@id":"https:\/\/tekno.bali-island.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tekno.bali-island.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/tekno.bali-island.com\/en\/#organization","name":"Bali Island Tekno","url":"https:\/\/tekno.bali-island.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tekno.bali-island.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/tekno.bali-island.com\/wp-content\/uploads\/2026\/04\/Logo-Tekno-Bali-Island.webp","contentUrl":"https:\/\/tekno.bali-island.com\/wp-content\/uploads\/2026\/04\/Logo-Tekno-Bali-Island.webp","width":512,"height":512,"caption":"Bali Island Tekno"},"image":{"@id":"https:\/\/tekno.bali-island.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/people\/Wilanpedia\/61575048527927\/"]},{"@type":"Person","@id":"https:\/\/tekno.bali-island.com\/en\/#\/schema\/person\/945426dbaeb9dc9d603797b51b1b7e42","name":"Wilan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b88f244258181b0b6313e5bf915a4aa9f133283d33124cb16947eb1389dc4bc5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b88f244258181b0b6313e5bf915a4aa9f133283d33124cb16947eb1389dc4bc5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b88f244258181b0b6313e5bf915a4aa9f133283d33124cb16947eb1389dc4bc5?s=96&d=mm&r=g","caption":"Wilan"},"sameAs":["https:\/\/tekno.bali-island.com"]}]}},"_links":{"self":[{"href":"https:\/\/tekno.bali-island.com\/en\/wp-json\/wp\/v2\/posts\/3006","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tekno.bali-island.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tekno.bali-island.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tekno.bali-island.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tekno.bali-island.com\/en\/wp-json\/wp\/v2\/comments?post=3006"}],"version-history":[{"count":1,"href":"https:\/\/tekno.bali-island.com\/en\/wp-json\/wp\/v2\/posts\/3006\/revisions"}],"predecessor-version":[{"id":3007,"href":"https:\/\/tekno.bali-island.com\/en\/wp-json\/wp\/v2\/posts\/3006\/revisions\/3007"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tekno.bali-island.com\/en\/wp-json\/wp\/v2\/media\/2998"}],"wp:attachment":[{"href":"https:\/\/tekno.bali-island.com\/en\/wp-json\/wp\/v2\/media?parent=3006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tekno.bali-island.com\/en\/wp-json\/wp\/v2\/categories?post=3006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tekno.bali-island.com\/en\/wp-json\/wp\/v2\/tags?post=3006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}