SQL(結構化查詢語言)是一種用于管理關系數據庫的編程語言
SELECT name, age FROM employees;
SELECT name, age FROM employees WHERE age > 30;
SELECT name, age FROM employees ORDER BY age DESC;
SELECT department, COUNT(*) FROM employees GROUP BY department;
SELECT e.name, e.age, d.department_name
FROM employees e
JOIN departments d ON e.department = d.department_id;
UPDATE employees SET salary = salary * 1.1 WHERE age > 30;
DELETE FROM employees WHERE age > 60;
INSERT INTO employees (name, age, department, salary)
VALUES ('John Doe', 35, 1, 50000);
這些基本案例展示了SQL的一些常見用法。實際應用中,SQL查詢可能會更復雜,包括子查詢、聚合函數等。但這些基本概念為理解和編寫SQL查詢提供了良好的起點。