SQL(Structured Query Language,結構化查詢語言)是一種用于管理關系數據庫的編程語言。以下是一些基本的SQL查詢示例:
SELECT * FROM table_name;
SELECT column1, column2 FROM table_name;
SELECT * FROM table_name WHERE condition;
SELECT * FROM table_name ORDER BY column_name ASC|DESC;
SELECT column1, aggregate_function(column2) FROM table_name GROUP BY column1;
SELECT * FROM table1 JOIN table2 ON table1.column = table2.column;
SELECT * FROM table_name WHERE column IN (SELECT column FROM another_table);
UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;
DELETE FROM table_name WHERE condition;
INSERT INTO table_name (column1, column2) VALUES (value1, value2);
請注意,這些示例僅涵蓋了SQL的基本功能。實際上,SQL提供了許多其他功能,如存儲過程、視圖、觸發器等。要編寫高效的SQL查詢,需要熟悉數據庫模式、索引、性能優化等方面的知識。