Skip to content

KEY

CREATE TABLE Students (
StudentID int,
StudentName varchar(255),
Age int,
PRIMARY KEY (StudentID)
);
INSERT INTO Students (StudentID, StudentName, Age)
VALUES (1, 'John Doe', 18), (2, 'Jane Doe', 20);
SELECT * FROM Students;
+-----------+-------------+-----+
| StudentID | StudentName | Age |
+-----------+-------------+-----+
| 1 | John Doe | 18 |
| 2 | Jane Doe | 20 |
+-----------+-------------+-----+

In the given example, a new table ‘Students’ is created with three fields - StudentID, StudentName, and Age. Among these, StudentID is defined as PRIMARY KEY. This key uniquely identifies each record in the table. Two rows of data are then inserted into the table. The SELECT * FROM Students query is used to display all the records from the Students table.