Skip to content

CHARACTER

CREATE TABLE Employees (
ID int,
Name CHARACTER(30),
Age int
);
INSERT INTO Employees (ID, Name, Age)
VALUES (1, 'John Doe', 30);
SELECT * FROM Employees;
+------+------------------+-----+
| ID | Name | Age |
+------+------------------+-----+
| 1 | John Doe | 30 |
+------+------------------+-----+

In this example, a table named ‘Employees’ is created with three columns - ‘ID’ as an integer, ‘Name’ as character data type of length 30, and ‘Age’ as an integer. Then, a new row is inserted into the ‘Employees’ table with ‘ID’ as 1, ‘Name’ as ‘John Doe’ and ‘Age’ as 30. Finally, all the records from the ‘Employees’ table are selected. The output shows the records retrieved from the table.