.Create a table MySql, called Student in the database College. This table has 7
ID: 3711457 • Letter: #
Question
.Create a table MySql, called Student in the database College. This table has 7 fields:
Two fields, student ID and phone_number are unsigned, 20-digit integers
Two fields, first_name and last_name are strings of up to 25 characters
Two fields, programme and school name are strings of up to 255 characters each
One field, status is the tiny text data object to store the short string.
Further, the specification indicates that none of these fields can be null: that is, each of these fields must contain data, and cannot be omitted from a record.
Explanation / Answer
Assuming College database has been already created.
// Command will use the College database.
Use College;
// Statement will create a table named Student with the given specification. Only NOT NULL constraint is used to // ensure no field is left blank.
CREATE TABLE Student
(
studentID BIGINT NOT NULL,
phone_number BIGINT NOT NULL,
first_name VARCHAR(25) NOT NULL,
last_name VARCHAR(25) NOT NULL,
programme VARCHAR(255) NOT NULL,
school_name VARCHAR(255) NOT NULL,
status TINYTEXT NOT NULL
);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.