CREATE TABLE professor(
INSERT INTO professor VALUES (1, 'Rohan', 57000);
ID int,
INSERT INTO professor VALUES (2, 'Aryan', 45000);
Name varchar(20),
INSERT INTO professor VALUES (3, 'Arpit', 60000);
Salary int
INSERT INTO professor VALUES (4, 'Harsh', 50000);
);
INSERT INTO professor VALUES (5, 'Tara', 55000);
CREATE TABLE teaches(
INSERT INTO teaches VALUES (1, 1, 'English');
course_id int,
INSERT INTO teaches VALUES (1, 3, 'Physics');
prof_id int,
INSERT INTO teaches VALUES (2, 4, 'Chemistry');
course_name varchar(20)
INSERT INTO teaches VALUES (2, 5, 'Mathematics');
);
Employees table: EmployeeUNI table:
+----+----------+ +----+-----------+
| id | name | | id | unique_id |
+----+----------+ +----+-----------+
| 1 | Alice | | 3 | 1 |
| 7 | Bob | | 11 | 2 |
| 11 | Meir | | 90 | 3 |
| 90 | Winston | +----+-----------+
| 3 | Jonathan |
+----+----------+
Employees table: EmployeeUNI table:
+----+----------+ +----+-----------+
| id | name | | id | unique_id |
+----+----------+ +----+-----------+
| 1 | Alice | | 3 | 1 |
| 7 | Bob | | 11 | 2 |
| 11 | Meir | | 90 | 3 |
| 90 | Winston | +----+-----------+
| 3 | Jonathan |
+----+----------+
ROUND(numeric, integer) is. Explicitly casting to NUMERIC resolves the mismatch.
CAST(... AS NUMERIC) is flexible for operations requiring precision control.