Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DROP TABLE IF EXISTS tabel;
- CREATE TABLE IF NOT EXISTS tabel(
- id INT AUTO_INCREMENT PRIMARY KEY,
- absen VARCHAR(2)
- );
- INSERT INTO tabel(absen)
- VALUES
- ('A'),
- ('S'),
- ('I'),
- ('I'),
- ('A'),
- ('S'),
- ('S'),
- ('I'),
- ('A');
- SELECT * FROM tabel;
- +----+-------+
- | id | absen |
- +----+-------+
- | 1 | A |
- | 2 | S |
- | 3 | I |
- | 4 | I |
- | 5 | A |
- | 6 | S |
- | 7 | S |
- | 8 | I |
- | 9 | A |
- +----+-------+
- 9 rows in set (0.00 sec)
- UPDATE
- tabel
- SET absen=IF(absen='A','I',IF(absen='I','A',absen));
- SELECT * FROM tabel;
- +----+-------+
- | id | absen |
- +----+-------+
- | 1 | I |
- | 2 | S |
- | 3 | A |
- | 4 | A |
- | 5 | I |
- | 6 | S |
- | 7 | S |
- | 8 | A |
- | 9 | I |
- +----+-------+
- 9 rows in set (0.00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement