Fundamentos de Bases de datos
Cómo diseñar bases de datos y hacer queries efectivos
Cómo identificar y organizar datos en bases de datos
Introducción práctica a SQL y bases de datos relacionales
Trabajo Directo con MySQL: Cliente, Servidor y Manejo de Errores
Instalación de MySQL en varios sistemas operativos
Quiz: Fundamentos de Bases de datos
Introducción a Bases de Datos Relacionales
Conceptos básicos de bases de datos: columnas, tuplas y relaciones
Creación de Tablas en MySQL con Tipos de Datos Esenciales
Creación de tablas en MySQL con Primary Key y Timestamp
Normalización y relaciones en bases de datos relacionales
Creación y visualización de bases de datos con DBML y DBDiagram
Quiz: Introducción a Bases de Datos Relacionales
Manipulación de Datos
Cómo crear tablas y utilizar 'Foreign Keys' en MySQL
Crear tablas y establecer llaves foráneas en SQL
Tipos de tablas en una base de datos relacional
Cómo Modificar Tablas en SQL con ALTER TABLE
Cómo Insertar Datos y Manejar Errores en MySQL
Creación Avanzada de una Tabla Products en MySQL
Uso práctico del WHERE en SQL para filtrar datos con precisión
Guía práctica para modificar datos usando UPDATE en SQL
Cómo eliminar datos en SQL: métodos lógicos y físicos
Uso Avanzado del Comando SELECT en SQL
Quiz: Manipulación de Datos
Agrupación de Datos
Funciones agregadoras en MySQL para análisis eficiente de datos
Insertar datos desde otra tabla en MySQL con Insert Into Select
Cómo utilizar Left Join en bases de datos relacionales
Cómo consultar y relacionar tablas en MySQL
You don't have access to this class
Keep learning! Join and start boosting your career
Learning how to create and manage tables in MySQL is key for any developer or professional working with relational databases. Here we will explore step by step how to create tables efficiently in MySQL with clear and simple examples using the most essential data types such as VARCHAR
, INT
, FLOAT
and TEXT
, and how to manage tables with useful commands such as SHOW TABLES
, DESCRIBE
and DROP TABLE
.
To create a table in MySQL, we use the CREATE TABLE
statement. It is advisable to write reserved words in capital letters for easy identification. A basic example would be:
CREATE TABLE clients ( name VARCHAR(100), email VARCHAR(60), phone VARCHAR(15));
Among the most frequent types are:
The choice will depend on the data to be stored and how it will be used later.
The main difference is the length and the practical use:
VARCHAR
is ideal for short fields such as names or emails.TEXT
is more useful for long and detailed descriptions.Example of the creation of a table with both types:
CREATE TABLE products ( name VARCHAR(20), SKU VARCHAR(15), slog VARCHAR(20), description TEXT, price FLOAT);
In MySQL, some of the most useful commands to manage your databases are:
SHOW TABLES
: shows all existing tables.DESCRIBE table_name
: shows the structure and data type of a specific table.SHOW CREATE TABLE table_name
: shows the exact SQL command used to create that table.DROP TABLE table_name
: deletes a table and all the information it contains permanently.Practical examples:
DESCRIBE products;
SHOW CREATE TABLE products;
DROP TABLE clients;
Remember that DROP TABLE
will delete all information, so use it with caution.
Contributions 6
Questions 0
Want to see more contributions, questions and answers from the community?