The PRIMARY KEY
can be created on the same line when declaring a column,
CREATE TABLE student(
student_id INT PRIMARY KEY,
name VARCHAR(20),
major VARCHAR(20)
);
We use the PRIMARY KEY
to reference the table
Or, We can place the column we want inside the PRIMARY KEY()
function
CREATE TABLE student( student_id INT, name VARCHAR(20), major VARCHAR(20), PRIMARY KEY (student_id) ); DESCRIBE student