CHANGE : sütun adını ve tipini değiştirebiliriz.
MariaDB [grandhotel]> select * from Zimmer;
+-----------+--------------+
| zimmer_id | kategorie_id |
+-----------+--------------+
| 101 | 1 |
| 102 | 1 |
| 103 | 1 |
| 104 | 2 |
+-----------+--------------+
4 rows in set (0.00 sec)
MariaDB [grandhotel]> alter table Zimmer change kategorie_id kat_id float(4,2);
Query OK, 4 rows affected (0.09 sec)
Records: 4 Duplicates: 0 Warnings: 0
MariaDB [grandhotel]> select * from Zimmer;
+-----------+--------+
| zimmer_id | kat_id |
+-----------+--------+
| 101 | 1.00 |
| 102 | 1.00 |
| 103 | 1.00 |
| 104 | 2.00 |
+-----------+--------+
4 rows in set (0.00 sec)
MODIFY : Sütun ismni değiştirmeden tipini değiştirebiliriz.
MariaDB [grandhotel]> alter table Zimmer modify kategorie_id float(4,2);
Query OK, 4 rows affected (0.09 sec)
Records: 4 Duplicates: 0 Warnings: 0
MariaDB [grandhotel]> select * from Zimmer;
+-----------+--------------+
| zimmer_id | kategorie_id |
+-----------+--------------+
| 101 | 1.00 |
| 102 | 1.00 |
| 103 | 1.00 |
| 104 | 2.00 |
+-----------+--------------+
4 rows in set (0.00 sec)
ASC ve DESC : Artan veya azalan şeklinde sıralama
MariaDB [grandhotel]> select g_name,g_plz from Gast order by g_plz asc;
+---------+-------+
| g_name | g_plz |
+---------+-------+
| Meier | 11111 |
| Schulze | 22222 |
| Müller | 33333 |
+---------+-------+
3 rows in set (0.00 sec)
MariaDB [grandhotel]> select g_name,g_plz from Gast order by g_plz;
+---------+-------+
| g_name | g_plz |
+---------+-------+
| Meier | 11111 |
| Schulze | 22222 |
| Müller | 33333 |
+---------+-------+
3 rows in set (0.00 sec)
MariaDB [grandhotel]> select g_name,g_plz from Gast order by g_plz desc;
+---------+-------+
| g_name | g_plz |
+---------+-------+
| Müller | 33333 |
| Schulze | 22222 |
| Meier | 11111 |
+---------+-------+
3 rows in set (0.00 sec)
Count() : adet sayısı
MariaDB [grandhotel]> select count(g_name) from Gast;
+---------------+
| count(g_name) |
+---------------+
| 3 |
+---------------+
1 row in set (0.29 sec)
Limit : sonuç veya işlem sınırlandırma
MariaDB [grandhotel]> select g_name from Gast limit 2;
+---------+
| g_name |
+---------+
| Meier |
| Schulze |
+---------+
Limit te sayı 0 dan başlar ve devam eder. İstersek işlemi 2nci kayıttan itibaren 2 adet olarak bile limitleyebiliriz.
MariaDB [grandhotel]> select g_name from Gast;
+---------+
| g_name |
+---------+
| Meier |
| Schulze |
| Müller |
+---------+
3 rows in set (0.00 sec)
MariaDB [grandhotel]> select g_name from Gast limit 1,1;
+---------+
| g_name |
+---------+
| Schulze |
+---------+
1 row in set (0.00 sec)
WHERE
MariaDB [grandhotel]> select g_name,g_plz from Gast where g_plz > 11112;
+---------+-------+
| g_name | g_plz |
+---------+-------+
| Schulze | 22222 |
| Müller | 33333 |
+---------+-------+
2 rows in set (0.00 sec)
Where içinde kullanabileceğimiz aritmetik operatörler
= <> > < >= <=
Where içinde kullanabileceğimiz logik operatörler
AND OR NOT
Where içinde benzerlik LIKE ve * yerine %
BETWEEN
MariaDB [grandhotel]> select g_name,g_plz from Gast where g_plz between "11112" and "33332";
+---------+-------+
| g_name | g_plz |
+---------+-------+
| Schulze | 22222 |
+---------+-------+
1 row in set (0.00 sec)