Learn Database Design with MySQL
A well-designed database is crucial for a fast, efficient, and scalable application. Here are the fundamental SQL commands.
1. Creating a Table
The `CREATE TABLE` statement is used to create a new table in a database.
CREATE TABLE employees (
id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
email VARCHAR(100) UNIQUE,
hire_date DATE
);2. Inserting Data
The `INSERT INTO` statement is used to add new rows of data to a table.
INSERT INTO employees (first_name, last_name, email, hire_date)
VALUES ('Siraw', 'Tadesse', 'siraw@sirawdev.com.et', '2025-01-10');3. Selecting Data
The `SELECT` statement is used to query the database and retrieve data that matches criteria that you specify.
SELECT id, first_name, email FROM employees WHERE last_name = 'Tadesse';