		
		{"id":18504,"date":"2024-07-19T09:44:15","date_gmt":"2024-07-19T09:44:15","guid":{"rendered":"http:\/\/localhost\/netizens_12_aug\/?p=12466"},"modified":"2024-07-19T09:44:15","modified_gmt":"2024-07-19T09:44:15","slug":"mysql-create-tables","status":"publish","type":"post","link":"https:\/\/netizens.netizens.dev\/br\/blog\/mysql-create-tables\/","title":{"rendered":"How to Create Tables in MySQL? A Full Guide for Beginners"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">In creating a MySQL database, one of the most important things to know is how to create a table in MySQL. However, it is not only about data storage, but also about doing it effectively, safely, and efficiently, and in a manner that can expand. Tables with proper design not only ensure that queries run quicker but also that updates are simple and your database can expand. Using this guide, we will teach you how to create tables in MySQL correctly with tips, examples, and best practices for long-term performance.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Recap of Basic Concepts<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">It helps to refresh your mind on the basics before moving forward with creating MySQL tables:\u00a0<\/span><\/p>\n<p><b>Table:<\/b><span style=\"font-weight: 400;\"> They are similar to spreadsheets, and are defined as a group of related information arranged in columns and rows.<\/span><\/p>\n<p><b>Row (Record):<\/b><span style=\"font-weight: 400;\"> An information or a record in the table, such as a single person, a single order, or a single product.<\/span><\/p>\n<p><b>Column (Field):<\/b><span style=\"font-weight: 400;\"> Columns hold specific types of data for each row, like name, age, or email address.<\/span><\/p>\n<p><b>Constraint:<\/b><span style=\"font-weight: 400;\"> Constraints are put on the columns to maintain a neat and clean data appearance and eliminate chances of duplicate records or vacant fields<\/span><\/p>\n<p><b>MySQL-specific things to remember:\u00a0<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Identifiers:<\/b><span style=\"font-weight: 400;\"> Are the names of databases, tables, and columns. If there is a clash of a name with a MySQL reserved word, it gets wrapped in backticks (`). <\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Default Database:<\/b><span style=\"font-weight: 400;\"> MySQL operates in the default database, and thus ensures that you are operating in the correct database before creating tables:<\/span><\/li>\n<\/ul>\n<pre style=\"background: #f8f8f8; color: #333; padding: 14px; border-radius: 6px; font-size: 14px; line-height: 1.6; overflow-x: auto; margin: 10px 0; border: 2px solid #ddd;\"><code>\n<span style=\"color: #0000cc; font-weight: bold;\">USE<\/span> <span style=\"color: #008800;\">database_name<\/span>;\n<\/code><\/pre>\n<h2><span style=\"font-weight: 400;\">Syntax &amp; Core Features<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">One of the initial steps when working with a MySQL database is the creation of a table; however, one must not only know the syntax, but also the purpose of each aspect and the reason why it is so. In simple terms, let us dissect it.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Creating a Table<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">You use the <\/span><span style=\"font-weight: 400;\">CREATE TABLE<\/span><span style=\"font-weight: 400;\"> statement to define a new table in your MySQL database. A simple syntax appears like this:<\/span><\/p>\n<pre style=\"background: #f8f8f8; color: #333; padding: 14px; border-radius: 6px; font-size: 14px; line-height: 1.6; overflow-x: auto; margin: 20px 0; border: 2px solid #ddd;\"><code>\n<span style=\"color: #0000cc; font-weight: bold;\">CREATE<\/span> <span style=\"color: #0000cc; font-weight: bold;\">TABLE<\/span> <span style=\"color: #008800;\">table_name<\/span> (\n    <span style=\"color: #008800;\">column1<\/span> datatype constraints,\n    <span style=\"color: #008800;\">column2<\/span> datatype constraints,\n    ...\n);\n<\/code><\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">table_name<\/span><span style=\"font-weight: 400;\"> is the name you give your table, like <\/span><span style=\"font-weight: 400;\">users<\/span><span style=\"font-weight: 400;\"> or <\/span><span style=\"font-weight: 400;\">orders<\/span><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Each <\/span><span style=\"font-weight: 400;\">column<\/span><span style=\"font-weight: 400;\"> defines a type of data you wish to store.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Datatype<\/span><span style=\"font-weight: 400;\"> will let MySQL know what kind of information should go in that column.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Constraints<\/span><span style=\"font-weight: 400;\"> are rules that maintain data accuracy and clarity.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">When you are clear with this structure, creating a new table is more than typing code; it\u2019s about planning how data lives in your MySQL database.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Most Common Data Types<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Every MySQL table has a series of columns, all with a data type that defines what type of information it stores. Choosing the correct data type is mandatory for performance.\u00a0<\/span><\/p>\n<p><b>INT:<\/b><span style=\"font-weight: 400;\"> Stores whole numbers. INT is suitable for storing data about Ideal for IDs, counts, or any numeric value that doesn\u2019t need decimals.<\/span><\/p>\n<p><b>VARCHAR(size):<\/b><span style=\"font-weight: 400;\"> Stores variable-length strings, such as names, emails, or titles. <\/span><span style=\"font-weight: 400;\">Size<\/span><span style=\"font-weight: 400;\"> defines the maximum character limit for columns.\u00a0<\/span><\/p>\n<p><b>TEXT:<\/b><span style=\"font-weight: 400;\"> TEXT is used for large text entries, such as blogs or comment sections. Compared to <\/span><span style=\"font-weight: 400;\">VARCHAR<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">it&#8217;s capable of holding much more text.\u00a0\u00a0\u00a0<\/span><\/p>\n<p><b>DATE:<\/b><span style=\"font-weight: 400;\"> Storage of dates is possible using the <\/span><span style=\"font-weight: 400;\">YYYY-MM-DD<\/span><span style=\"font-weight: 400;\"> format, which is perfect for birthdays, order dates, or registration dates.<\/span><\/p>\n<p><b>TIMESTAMP:<\/b><span style=\"font-weight: 400;\"> Stores date and time simultaneously, which is useful for tracking the creation or updating of a record.<\/span><\/p>\n<p><b>BOOLEAN:<\/b><span style=\"font-weight: 400;\"> Will hold true\/false values, used for flags such as <\/span><span style=\"font-weight: 400;\">is_active<\/span><span style=\"font-weight: 400;\"> or <\/span><span style=\"font-weight: 400;\">is_admin<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Seldom choosing the appropriate data type will ensure your MySQL database is faster, consumes less storage, and lessens future errors.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Constraints<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Rules are known as constraints that you put on the columns to ensure that your database is in a good state and is reliable. Consider them as protection of your information.<\/span><\/p>\n<p><b>NOT NULL:<\/b><span style=\"font-weight: 400;\"> This ensures a column cannot be left empty. Each user must have a username, so that column should never be null.<\/span><\/p>\n<p><b>AUTO_INCREMENT:<\/b><span style=\"font-weight: 400;\"> Automatically generates a number for each new record, commonly used for IDs. It saves your time as manually entering these values is eliminated.<\/span><\/p>\n<p><b>DEFAULT: <\/b><span style=\"font-weight: 400;\">This provides a default value if no other value is available. For instance, you could set a user\u2019s status to <\/span><span style=\"font-weight: 400;\">active<\/span><span style=\"font-weight: 400;\"> by default when a new account is created.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Using the appropriate constraints will ensure that your MySQL database remains clean, eliminates errors, and simplifies future queries of your data.<\/span><\/p>\n<pre><strong>Example Table: Users<\/strong><\/pre>\n<p><span style=\"font-weight: 400;\">Here\u2019s a simple example of a users table in a MySQL database:<\/span><\/p>\n<pre style=\"background: #f8f8f8; color: #333; padding: 14px; border-radius: 6px; font-size: 14px; line-height: 1.6; overflow-x: auto; margin: 20px 0; border: 2px solid #ddd;\"><code>\n<span style=\"color: #0000cc; font-weight: bold;\">CREATE<\/span> <span style=\"color: #0000cc; font-weight: bold;\">TABLE<\/span> <span style=\"color: #008800;\">users<\/span> (\n    <span style=\"color: #008800;\">id<\/span> INT AUTO_INCREMENT,\n    <span style=\"color: #008800;\">username<\/span> VARCHAR(50) <span style=\"color: #0000cc; font-weight: bold;\">NOT NULL<\/span>,\n    <span style=\"color: #008800;\">email<\/span> VARCHAR(100),\n    <span style=\"color: #008800;\">created_at<\/span> TIMESTAMP <span style=\"color: #0000cc; font-weight: bold;\">DEFAULT<\/span> CURRENT_TIMESTAMP,\n    <span style=\"color: #0000cc; font-weight: bold;\">PRIMARY KEY<\/span> (<span style=\"color: #008800;\">id<\/span>)\n);\n<\/code><\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Id:<\/b><span style=\"font-weight: 400;\"> A unique identifier for each user. <\/span><span style=\"font-weight: 400;\">INT AUTO_INCREMENT<\/span><span style=\"font-weight: 400;\"> allows users to automatically receive a new unassigned number.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Username:<\/b><span style=\"font-weight: 400;\"> A required field (<\/span><span style=\"font-weight: 400;\">NOT NULL<\/span><span style=\"font-weight: 400;\">) because each individual user needs a username.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>email:<\/b><span style=\"font-weight: 400;\"> Optional, but stored as a <\/span><span style=\"font-weight: 400;\">VARCHAR(100)<\/span><span style=\"font-weight: 400;\"> to hold email addresses.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>created_at:<\/b><span style=\"font-weight: 400;\"> Tracks when the record was created. The <\/span><span style=\"font-weight: 400;\">DEFAULT CURRENT_TIMESTAMP<\/span><span style=\"font-weight: 400;\"> makes it automatic.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>PRIMARY KEY (id):<\/b><span style=\"font-weight: 400;\"> Ensures that each user can be uniquely identified in the database.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">This is a simple table format, but it shows how a well-structured MySQL database table can organize data, impose restrictions, and provide the basis of scalable and reliable applications.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Constraints &amp; Keys<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">In the case of a MySQL database, constraints and keys can prove to be very useful in ensuring your data is precise, consistent, and credible. Think of them as rules and relationships that guide how data behaves inside your tables.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Types of Constraints<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Constraints are the rules that you impose on the columns of the tables in an attempt to enforce data integrity. In their absence, it is easy to find your database filled with duplicate, lost, or inconsistent information. Let\u2019s look at the constraints by going through the important types:\u00a0<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">1. Primary Key<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">A <\/span><b>primary key<\/b><span style=\"font-weight: 400;\"> is a column (or a set of columns) that specifically identifies each record in a table.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">A table must have only one primary key at a time.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Note that a primary key&#8217;s value can never be <\/span><span style=\"font-weight: 400;\">NULL<\/span><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">They ensure that each row is uniquely distinguishable, which is essential for managing and linking data across a database.<\/span><\/li>\n<\/ul>\n<p><b>Example:<\/b><span style=\"font-weight: 400;\"> In a <\/span><span style=\"font-weight: 400;\">users<\/span><span style=\"font-weight: 400;\"> table, the <\/span><span style=\"font-weight: 400;\">id<\/span><span style=\"font-weight: 400;\"> column is typically the primary key because it uniquely identifies each user.<\/span><\/p>\n<pre style=\"background: #f8f8f8; color: #333; padding: 14px; border-radius: 6px; font-size: 14px; line-height: 1.6; overflow-x: auto; margin: 20px 0; border: 2px solid #ddd;\"><code>\n<span style=\"color: #0000cc; font-weight: bold;\">PRIMARY KEY<\/span> (<span style=\"color: #008800;\">id<\/span>)\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">This guarantees that no two users will ever get identical <\/span><span style=\"font-weight: 400;\">IDs<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">2. Unique<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">The unique constraint ensures that values in a column are unique.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">A table can have multiple unique constraints at a time.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">It aids in email address or username fields, where duplication is problematic.<\/span><\/li>\n<\/ul>\n<p><b>Example:<\/b><\/p>\n<pre style=\"background: #f8f8f8; color: #333; padding: 14px; border-radius: 6px; font-size: 14px; line-height: 1.6; overflow-x: auto; margin: 20px 0; border: 2px solid #ddd;\"><code>\n<span style=\"color: #008800;\">username<\/span> VARCHAR(50) <span style=\"color: #0000cc; font-weight: bold;\">UNIQUE<\/span>\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Here, no two users can possess identical usernames in your MySQL database.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">3. Foreign Key<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">The <\/span><b>foreign key<\/b><span style=\"font-weight: 400;\"> is the one column in a table that links to the <\/span><b>primary key<\/b><span style=\"font-weight: 400;\"> in another table.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">This key imposes <\/span><b>referential integrity<\/b><span style=\"font-weight: 400;\"> by solidifying relationships between tables.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">They avoid cases of \u201corphaned\u201d data by allowing values from one table to correspond to valid entries in another table.<\/span><\/li>\n<\/ul>\n<p><b>Example:<\/b><\/p>\n<pre style=\"background: #f8f8f8; color: #333; padding: 14px; border-radius: 6px; font-size: 14px; line-height: 1.6; overflow-x: auto; margin: 20px 0; border: 2px solid #ddd;\"><code>\n<span style=\"color: #0000cc; font-weight: bold;\">FOREIGN KEY<\/span> (<span style=\"color: #008800;\">customer_id<\/span>) \n<span style=\"color: #0000cc; font-weight: bold;\">REFERENCES<\/span> <span style=\"color: #008800;\">users<\/span>(<span style=\"color: #008800;\">id<\/span>)\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Here, the <\/span><span style=\"font-weight: 400;\">customer_id<\/span><span style=\"font-weight: 400;\"> in the <\/span><span style=\"font-weight: 400;\">orders<\/span><span style=\"font-weight: 400;\"> table must match a valid <\/span><span style=\"font-weight: 400;\">id<\/span><span style=\"font-weight: 400;\"> in the <\/span><span style=\"font-weight: 400;\">users<\/span><span style=\"font-weight: 400;\"> table. It keeps your MySQL database true because orders cannot exist without customers.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">4. Check<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">A check constraint checks that the values in columns meet a set of conditions.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Available in <\/span><b>MySQL 8.0 and above<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">This supports business rules in your database, eliminating errors.<\/span><\/li>\n<\/ul>\n<p><b>Example:<\/b><\/p>\n<pre style=\"background: #f8f8f8; color: #333; padding: 14px; border-radius: 6px; font-size: 14px; line-height: 1.6; overflow-x: auto; margin: 20px 0; border: 2px solid #ddd;\"><code>\n<span style=\"color: #0000cc; font-weight: bold;\">CHECK<\/span> (<span style=\"color: #008800;\">quantity<\/span> &gt; 0)\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">This ensures that you can never insert an order with a negative quantity.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Example Table: Orders with Foreign Key<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">To get an idea of how they all come together in a real table:<\/span><\/p>\n<pre style=\"background: #f8f8f8; color: #333; padding: 14px; border-radius: 6px; font-size: 14px; line-height: 1.6; overflow-x: auto; margin: 20px 0; border: 2px solid #ddd;\"><code>\n<span style=\"color: #0000cc; font-weight: bold;\">CREATE<\/span> <span style=\"color: #0000cc; font-weight: bold;\">TABLE<\/span> <span style=\"color: #008800;\">orders<\/span> (\n    <span style=\"color: #008800;\">order_id<\/span> INT AUTO_INCREMENT,\n    <span style=\"color: #008800;\">order_date<\/span> DATE,\n    <span style=\"color: #008800;\">customer_id<\/span> INT,\n    <span style=\"color: #0000cc; font-weight: bold;\">PRIMARY KEY<\/span> (<span style=\"color: #008800;\">order_id<\/span>),\n    <span style=\"color: #0000cc; font-weight: bold;\">FOREIGN KEY<\/span> (<span style=\"color: #008800;\">customer_id<\/span>) \n        <span style=\"color: #0000cc; font-weight: bold;\">REFERENCES<\/span> <span style=\"color: #008800;\">users<\/span>(<span style=\"color: #008800;\">id<\/span>)\n);\n<\/code><\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>order_id:<\/b><span style=\"font-weight: 400;\"> Uniquely identifies each order using <\/span><span style=\"font-weight: 400;\">PRIMARY KEY<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">AUTO_INCREMENT<\/span><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>order_date:<\/b><span style=\"font-weight: 400;\"> It collects and notes the date of order creation. <\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>customer_id:<\/b><span style=\"font-weight: 400;\"> Links each order to a valid user in the <\/span><span style=\"font-weight: 400;\">users<\/span><span style=\"font-weight: 400;\"> table using a <\/span><span style=\"font-weight: 400;\">FOREIGN KEY<\/span><span style=\"font-weight: 400;\">.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">The table shows the use of constraints and keys in a MySQL database to ensure data accuracy and link tables together. With their proper usage, you end up with not only a functional, but also robust, reliable, and scaled-down database.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Advanced Table Features<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">After knowing the fundamentals of making a table with a MySQL database, it is time to learn some of the advanced features that will allow you to make your tables stronger, effective, and malleable. These traits allow you to work with complex computations, huge data, and multi-language data, not to mention that your database is reliable.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">1. Generated Columns<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">These specially <\/span><b>generated columns<\/b><span style=\"font-weight: 400;\"> have their values automatically calculated using other columns in the table.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">These reduce time wastage and errors by substituting manual calculations each time you input or update data.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">As the creator, you will decide whether the column is stored (saved on disk) or virtual (calculated on the spot).<\/span><\/li>\n<\/ul>\n<p><b>Example: Invoices Table<\/b><\/p>\n<pre style=\"background: #f8f8f8; color: #333; padding: 14px; border-radius: 6px; font-size: 14px; line-height: 1.6; overflow-x: auto; margin: 20px 0; border: 2px solid #ddd;\"><code>\n<span style=\"color: #0000cc; font-weight: bold;\">CREATE TABLE<\/span> <span style=\"color: #008800;\">invoices<\/span> (\n    <span style=\"color: #008800;\">subtotal<\/span> DECIMAL(10,2),\n    <span style=\"color: #008800;\">tax_rate<\/span> DECIMAL(3,2),\n    <span style=\"color: #008800;\">total<\/span> DECIMAL(10,2) \n        <span style=\"color: #0000cc; font-weight: bold;\">GENERATED ALWAYS AS<\/span> (<span style=\"color: #008800;\">subtotal<\/span> * (1 + <span style=\"color: #008800;\">tax_rate<\/span>)) \n        <span style=\"color: #0000cc; font-weight: bold;\">STORED<\/span>\n);\n<\/code><\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Subtotal:<\/b><span style=\"font-weight: 400;\"> The base invoice amount.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>tax_rate:<\/b><span style=\"font-weight: 400;\"> The taxation percentage that applies to the amount.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>total:<\/b><span style=\"font-weight: 400;\"> Automatically calculated as <\/span><span style=\"font-weight: 400;\">subtotal * (1 + tax_rate)<\/span><span style=\"font-weight: 400;\"> every time a row is inserted or updated.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">This feature makes your MySQL database smarter and reduces the chance of human error in repetitive calculations.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">2. Partitioning<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">This action divides a large table into smaller, more manageable pieces known as partitions.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Partitions act as miniature tables and are part of the same logical table<\/span><\/p>\n<p><span style=\"font-weight: 400;\">They improve query performance, particularly for tables with millions of rows.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It can also make maintenance tasks, like archiving old data, easier.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Indicatively, an orders table can be partitioned based on year or region, i.e., when a query involves recent orders, only a limited portion of the table is scanned rather than the whole data.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Segmentation is another great option to scale your MySQL database in case you are sure that it is going to expand massively in the future.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">3. Storage Engines<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">By default, MySQL will support various storage engines. Storage engine selection decides how to store, access, and manage data. The two most common engines are:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>InnoDB:<\/b>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Transaction-safe (supports <\/span><span style=\"font-weight: 400;\">COMMIT<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">ROLLBACK<\/span><span style=\"font-weight: 400;\">).<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Supports foreign keys and constraints for maintaining relational integrity.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Suit applications that prioritize data consistency above anything else.<\/span><\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>MyISAM:<\/b>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Faster for read-heavy operations.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Lacks transaction and foreign key support.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Good for analytics or reporting databases where inserts and updates are minimal.<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Choosing the right storage engine is crucial for balancing performance, reliability, and data integrity in your MySQL database.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">4. Character Sets &amp; Collation<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">A <\/span><b>Character set<\/b><span style=\"font-weight: 400;\"> defines the types of characters that any one column can store. <\/span><b>Collation<\/b><span style=\"font-weight: 400;\"> decides how each of these characters will be compared and sorted.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">They are critical to deliver multi-language support.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">ORDER BY<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">WHERE<\/span><span style=\"font-weight: 400;\"> functions perform as you need with text due to the character set and collation.<\/span><\/li>\n<\/ul>\n<p><b>Example:<\/b><\/p>\n<pre style=\"background: #f8f8f8; color: #333; padding: 14px; border-radius: 6px; font-size: 14px; line-height: 1.6; overflow-x: auto; margin: 20px 0; border: 2px solid #ddd;\"><code>\n<span style=\"color: #0000cc; font-weight: bold;\">CREATE TABLE<\/span> <span style=\"color: #008800;\">messages<\/span> (\n    <span style=\"color: #008800;\">message_id<\/span> INT AUTO_INCREMENT <span style=\"color: #0000cc; font-weight: bold;\">PRIMARY KEY<\/span>,\n    <span style=\"color: #008800;\">content<\/span> VARCHAR(500) \n        <span style=\"color: #0000cc; font-weight: bold;\">CHARACTER SET<\/span> utf8mb4 \n        <span style=\"color: #0000cc; font-weight: bold;\">COLLATE<\/span> utf8mb4_general_ci\n);\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Here, <\/span><span style=\"font-weight: 400;\">utf8mb4<\/span><span style=\"font-weight: 400;\"> facilitates emoji and character storage from multiple languages, while <\/span><span style=\"font-weight: 400;\">utf8mb4_general_ci<\/span><span style=\"font-weight: 400;\"> handles case-insensitive comparisons.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">By setting the correct character set and collation, you make your MySQL database ready for global applications and avoid encoding issues.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Indexing &amp; Query Performance in MySQL<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">In a typical MySQL database, indexes perform the function of a shortcut to find the data you need immediately. Instead of going through the entire table, a MySQL index jumps directly to the spot containing the data you need.<\/span><\/p>\n<p><b>Primary Key Index:<\/b><span style=\"font-weight: 400;\"> Automatically created when you define a primary key.<\/span><\/p>\n<p><b>Unique Index:<\/b><span style=\"font-weight: 400;\"> This function ensures duplicates cannot exist (like two users with identical email addresses).<\/span><\/p>\n<p><b>Composite Index:<\/b><span style=\"font-weight: 400;\"> It merges columns to accelerate data searches.<\/span><\/p>\n<p><b>Note: <\/b><span style=\"font-weight: 400;\">too many indexes can slow down inserts and updates, and they hold extra disk space.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Example: Composite Index on <\/span><span style=\"font-weight: 400;\">username<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">email<\/span><\/h3>\n<pre style=\"background: #f8f8f8; color: #333; padding: 14px; border-radius: 6px; font-size: 14px; line-height: 1.6; overflow-x: auto; margin: 20px 0; border: 2px solid #ddd;\"><code>\n<span style=\"color: #0000cc; font-weight: bold;\">CREATE INDEX<\/span> <span style=\"color: #008800;\">idx_username_email<\/span> \n    <span style=\"color: #0000cc; font-weight: bold;\">ON<\/span> <span style=\"color: #008800;\">users<\/span>(<span style=\"color: #008800;\">username<\/span>, <span style=\"color: #008800;\">email<\/span>);\n<\/code><\/pre>\n<h2><span style=\"font-weight: 400;\">Best Practices for MySQL Table Design<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">When designing tables in your MySQL database, good practices can save you from errors later. See this brief checklist to follow:\u00a0<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Use the right data types:<\/b><span style=\"font-weight: 400;\"> Always pick the smallest data type that fits your needs. For example, use <\/span><span style=\"font-weight: 400;\">TINYINT<\/span><span style=\"font-weight: 400;\"> instead of <\/span><span style=\"font-weight: 400;\">INT<\/span><span style=\"font-weight: 400;\"> if values are small. This keeps storage efficient.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Define primary keys:<\/b><span style=\"font-weight: 400;\"> Every table should have a primary key, which uniquely identifies each row and improves indexing and performance.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Set up foreign keys:<\/b><span style=\"font-weight: 400;\"> Leveraging foreign keys to maintain relationships between tables (like users and orders) will uphold data integrity without manual intervention.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Normalize your data:<\/b><span style=\"font-weight: 400;\"> Break data into separate tables to avoid duplication and keep your database clean and consistent.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Back up regularly:<\/b><span style=\"font-weight: 400;\"> Databases can fail; always have a backup strategy to prevent data loss.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Monitor the queries and indexes:<\/b><span style=\"font-weight: 400;\"> Assess your query performance. Add indexes if necessary, but note that using too many can hinder the process.\u00a0<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-weight: 400;\">FAqs<\/span><\/h2>\n<div style=\"margin: 10px 0; line-height: 1.8;\">\n<div style=\"padding: 10px 0; border-bottom: 1px solid #ddd;\">\n<h3 style=\"margin: 0 0 6px;\">1. What is the difference between a primary key and a unique key in MySQL?<\/h3>\n<p style=\"margin: 0;\">A primary key uniquely identifies each row in a table, and only one can exist per table.<\/p>\n<p style=\"margin: 0;\">A unique key also enforces uniqueness, but multiple unique keys can exist in a table.<\/p>\n<\/div>\n<div style=\"padding: 10px 0; border-bottom: 1px solid #ddd;\">\n<h3 style=\"margin: 0 0 6px;\">2. Why are foreign keys important in MySQL?<\/h3>\n<p style=\"margin: 0;\">Foreign keys establish relationships between tables. For example, linking orders to users ensures that every order belongs to a valid user, maintaining data integrity.<\/p>\n<\/div>\n<div style=\"padding: 10px 0; border-bottom: 1px solid #ddd;\">\n<h3 style=\"margin: 0 0 6px;\">3. How often should I back up a MySQL database?<\/h3>\n<p style=\"margin: 0;\">It depends on your usage. For critical systems, take daily backups (or even real-time replication). For smaller projects, weekly backups may suffice.<\/p>\n<\/div>\n<div style=\"padding: 10px 0;\">\n<h3 style=\"margin: 0 0 6px;\">4. What are the most common mistakes when creating tables in MySQL?<\/h3>\n<ul style=\"margin: 0; padding-left: 20px;\">\n<li>Using incorrect data types (e.g., TEXT for short strings).<\/li>\n<li>Forgetting to define a primary key.<\/li>\n<li>Not indexing columns used in searches.<\/li>\n<li>Ignoring regular backups.<\/li>\n<\/ul>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>In creating a MySQL database, one of the most important things to know is how to create a table in MySQL. However, it is not only about data storage, but also about doing it effectively, safely, and efficiently, and in a manner that can expand. Tables with proper design not only ensure that queries run [&hellip;]<\/p>","protected":false},"author":2,"featured_media":18591,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1011],"tags":[],"class_list":["post-18504","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-other"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Create Tables in MySQL? A Beginner&#039;s to Advanced Guide<\/title>\n<meta name=\"description\" content=\"Learn to create MySQL tables with syntax, data types, and constraints. Step-by-step guide for beginners to design efficient databases.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/netizens.netizens.dev\/br\/blog\/mysql-create-tables\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create Tables in MySQL? A Beginner&#039;s to Advanced Guide\" \/>\n<meta property=\"og:description\" content=\"Learn to create MySQL tables with syntax, data types, and constraints. Step-by-step guide for beginners to design efficient databases.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/netizens.netizens.dev\/br\/blog\/mysql-create-tables\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-19T09:44:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/netizens.netizens.dev\/wp-content\/uploads\/2024\/07\/mysql-create-table.png\" \/>\n\t<meta property=\"og:image:width\" content=\"645\" \/>\n\t<meta property=\"og:image:height\" content=\"360\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/\",\"url\":\"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/\",\"name\":\"How to Create Tables in MySQL? A Beginner's to Advanced Guide\",\"isPartOf\":{\"@id\":\"https:\/\/netizens.netizens.dev\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/netizens.netizens.dev\/wp-content\/uploads\/2024\/07\/mysql-create-table.png\",\"datePublished\":\"2024-07-19T09:44:15+00:00\",\"dateModified\":\"2024-07-19T09:44:15+00:00\",\"author\":{\"@id\":\"https:\/\/netizens.netizens.dev\/#\/schema\/person\/5db7227e686a10a4126a2c19b8b70517\"},\"description\":\"Learn to create MySQL tables with syntax, data types, and constraints. Step-by-step guide for beginners to design efficient databases.\",\"breadcrumb\":{\"@id\":\"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/#primaryimage\",\"url\":\"https:\/\/netizens.netizens.dev\/wp-content\/uploads\/2024\/07\/mysql-create-table.png\",\"contentUrl\":\"https:\/\/netizens.netizens.dev\/wp-content\/uploads\/2024\/07\/mysql-create-table.png\",\"width\":645,\"height\":360,\"caption\":\"Mysql create table\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/netizens.netizens.dev\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create Tables in MySQL? A Full Guide for Beginners\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/netizens.netizens.dev\/#website\",\"url\":\"https:\/\/netizens.netizens.dev\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/netizens.netizens.dev\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/netizens.netizens.dev\/#\/schema\/person\/5db7227e686a10a4126a2c19b8b70517\",\"name\":\"admin admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/netizens.netizens.dev\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b0f87bbe7cdbfbd534a40fea7d9d02021e6d3772c3949940e8de2e3df278fb2f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b0f87bbe7cdbfbd534a40fea7d9d02021e6d3772c3949940e8de2e3df278fb2f?s=96&d=mm&r=g\",\"caption\":\"admin admin\"},\"sameAs\":[\"https:\/\/netizens.netizens.dev\"],\"url\":\"https:\/\/netizens.netizens.dev\/br\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create Tables in MySQL? A Beginner's to Advanced Guide","description":"Learn to create MySQL tables with syntax, data types, and constraints. Step-by-step guide for beginners to design efficient databases.","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:\/\/netizens.netizens.dev\/br\/blog\/mysql-create-tables\/","og_locale":"pt_BR","og_type":"article","og_title":"How to Create Tables in MySQL? A Beginner's to Advanced Guide","og_description":"Learn to create MySQL tables with syntax, data types, and constraints. Step-by-step guide for beginners to design efficient databases.","og_url":"https:\/\/netizens.netizens.dev\/br\/blog\/mysql-create-tables\/","article_published_time":"2024-07-19T09:44:15+00:00","og_image":[{"width":645,"height":360,"url":"https:\/\/netizens.netizens.dev\/wp-content\/uploads\/2024\/07\/mysql-create-table.png","type":"image\/png"}],"author":"admin admin","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"admin admin","Est. tempo de leitura":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/","url":"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/","name":"How to Create Tables in MySQL? A Beginner's to Advanced Guide","isPartOf":{"@id":"https:\/\/netizens.netizens.dev\/#website"},"primaryImageOfPage":{"@id":"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/#primaryimage"},"image":{"@id":"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/#primaryimage"},"thumbnailUrl":"https:\/\/netizens.netizens.dev\/wp-content\/uploads\/2024\/07\/mysql-create-table.png","datePublished":"2024-07-19T09:44:15+00:00","dateModified":"2024-07-19T09:44:15+00:00","author":{"@id":"https:\/\/netizens.netizens.dev\/#\/schema\/person\/5db7227e686a10a4126a2c19b8b70517"},"description":"Learn to create MySQL tables with syntax, data types, and constraints. Step-by-step guide for beginners to design efficient databases.","breadcrumb":{"@id":"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/#primaryimage","url":"https:\/\/netizens.netizens.dev\/wp-content\/uploads\/2024\/07\/mysql-create-table.png","contentUrl":"https:\/\/netizens.netizens.dev\/wp-content\/uploads\/2024\/07\/mysql-create-table.png","width":645,"height":360,"caption":"Mysql create table"},{"@type":"BreadcrumbList","@id":"https:\/\/netizens.netizens.dev\/blog\/mysql-create-tables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/netizens.netizens.dev\/"},{"@type":"ListItem","position":2,"name":"How to Create Tables in MySQL? A Full Guide for Beginners"}]},{"@type":"WebSite","@id":"https:\/\/netizens.netizens.dev\/#website","url":"https:\/\/netizens.netizens.dev\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/netizens.netizens.dev\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Person","@id":"https:\/\/netizens.netizens.dev\/#\/schema\/person\/5db7227e686a10a4126a2c19b8b70517","name":"admin admin","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/netizens.netizens.dev\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b0f87bbe7cdbfbd534a40fea7d9d02021e6d3772c3949940e8de2e3df278fb2f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b0f87bbe7cdbfbd534a40fea7d9d02021e6d3772c3949940e8de2e3df278fb2f?s=96&d=mm&r=g","caption":"admin admin"},"sameAs":["https:\/\/netizens.netizens.dev"],"url":"https:\/\/netizens.netizens.dev\/br\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/netizens.netizens.dev\/br\/wp-json\/wp\/v2\/posts\/18504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netizens.netizens.dev\/br\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netizens.netizens.dev\/br\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netizens.netizens.dev\/br\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/netizens.netizens.dev\/br\/wp-json\/wp\/v2\/comments?post=18504"}],"version-history":[{"count":0,"href":"https:\/\/netizens.netizens.dev\/br\/wp-json\/wp\/v2\/posts\/18504\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netizens.netizens.dev\/br\/wp-json\/wp\/v2\/media\/18591"}],"wp:attachment":[{"href":"https:\/\/netizens.netizens.dev\/br\/wp-json\/wp\/v2\/media?parent=18504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netizens.netizens.dev\/br\/wp-json\/wp\/v2\/categories?post=18504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netizens.netizens.dev\/br\/wp-json\/wp\/v2\/tags?post=18504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}