INSERT INTO tickets(title, priority)
VALUES('Scan virus for computer A', 'High');
INSERT INTO tickets(title, priority)
VALUES('Upgrade Windows OS for all computers', 1);
INSERT INTO tickets(title, priority)
VALUES('Install Google Chrome for Mr. John', 'Medium'),
('Create a new user for the new employee David', 'High');
INSERT INTO tickets(title)
VALUES('Refresh the computer of Ms. Lily');
SELECT
*
FROM
tickets
WHERE
priority = 'High';
+----+----------------------------------------------+----------+
| id | title | priority |
+----+----------------------------------------------+----------+
| 1 | Scan virus for computer A | High |
| 4 | Create a new user for the new employee David | High |
+----+----------------------------------------------+----------+
2 rows in set
SELECT
*
FROM
tickets
WHERE
priority = 3;
SELECT
*
FROM
tickets
WHERE
priority >= 2;
SELECT
title, priority
FROM
tickets
ORDER BY priority DESC;
+----------------------------------------------+----------+
| title | priority |
+----------------------------------------------+----------+
| Scan virus for computer A | High |
| Create a new user for the new employee David | High |
| Install Google Chrome for Mr. John | Medium |
| Upgrade Windows OS for all computers | Low |
| Refresh the computer of Ms. Lily | Low |
+----------------------------------------------+----------+
5 rows in set
information_schema
SELECT
column_type
FROM
information_schema.COLUMNS
WHERE
TABLE_NAME = 'tickets'
AND COLUMN_NAME = 'priority';