Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> MySQL

วิธีเขียนคำสั่ง MySQL หลายบรรทัด (Multiple-line Statement)


MySQL ใช้ Semicolon (;) ตัดสินว่าจบคำสั่ง ไม่ใช่ End-of-line จึงเขียนหลายบรรทัดได้:

mysql> Select *
    -> from
    -> stock_item;
+------------+-------+----------+
| item_name  | Value | Quantity |
+------------+-------+----------+
| Calculator |    15 |       89 |
| Notebooks  |    63 |       40 |
| Pencil     |    15 |       40 |
| Pens       |    65 |       32 |
| Shirts     |    13 |       29 |
| Shoes      |    15 |       29 |
| Trousers   |    15 |       29 |
+------------+-------+----------+
7 rows in set (0.00 sec)

คำอธิบาย: MySQL รวมบรรทัดจนเจอ Semicolon จึงรองรับ Free-format Input