เพิ่มคอลัมน์ที่ไม่มีในตารางด้วย AS keyword ไวยากรณ์:
SELECT yourColumnName1, yourColumnName2, ..., yourValue AS yourColumnName, ... FROM yourTableName;
สร้างตารางและแทรกข้อมูลเหมือนบทความก่อนหน้า (9 แถว)
แสดงข้อมูล:
mysql> select * from ColumnDoesNotExists;
ผลลัพธ์
+--------+----------+ | UserId | UserName | +--------+----------+ | 100 | Larry | | 101 | Sam | ... | 108 | James | +--------+----------+ 9 rows in set (0.00 sec)
ตัวอย่าง
เพิ่มคอลัมน์ Age:
mysql> select UserId, UserName, 23 AS Age from ColumnDoesNotExists;
ผลลัพธ์
+--------+----------+-----+ | UserId | UserName | Age | +--------+----------+-----+ | 100 | Larry | 23 | ... | 108 | James | 23 | +--------+----------+-----+ 9 rows in set (0.00 sec)