SELECT `name` ,`surname` ,count(`id`)
FROM `customer`
GROUP BY `name` ,`surname`
HAVING count(`id`) >1 ;
Code (C#)
DELETE `customer` AS tbDEL
FROM `customer` AS tbDEL ,
(
SELECT `name` ,`surname`
FROM `customer`
GROUP BY `name` ,`surname`
HAVING count(`id`) >1
) AS QR_DELETE
WHERE (QR_DELETE.`name`= tbDEL.`name`)
AND (QR_DELETE.`surname`= tbDEL.`surname`)
Code (C#)
/* 1.3 โจทย์เพี้ยน นับ เรคคอร์ดที่ 7 มันก้อมี record เดียว */
SELECT COUNT(`id`) FROM `customer`
WHERE `name` LIKE 'a%' LIMIT 6,1 ; /* LIMIT N-1 =>> record no N */
Code (C#)
CREATE UNIQUE INDEX `secondary_key` ON `customer` (`name` ,`surname`) ;
Code (C#)
ALTER TABLE `customer` ADD COLUMN `created_date` DATETIME DEFAULT NULL ;