Files
wen_0908/create_users_table.sql
2025-09-08 17:06:58 +08:00

17 lines
571 B
SQL

-- 建立 users 資料表
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(100) NOT NULL,
age INT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- 插入一些測試資料
INSERT INTO users (name, email, age) VALUES
('張三', 'zhang@example.com', 25),
('李四', 'li@example.com', 30),
('王五', 'wang@example.com', 22),
('趙六', 'zhao@example.com', 35),
('孫七', 'sun@example.com', 28);