Write the SQL statements for creating a table Event with primary key e_id, and an event date, e_date that cannot be null.
Also write the statements to create a table Participant with primary key p_id, a name that can be up to 30 characters long but may be shorter, and an event e_id as a foreign key that references the corresponding event.
1)CREATE TABLE Event (
e_id int NOT NULL PRIMARY KEY,
e_date DATE NOT NULL
);
2)CREATE TABLE Participant (
p_id int NOT NULL PRIMARY KEY,
name VARCHAR(30) NOT NULL,
e_id int FOREIGN KEY REFERENCES Event(e_id)
);
Note: Used VARCHAR because upto 30 characters.if fixed characters means use CHAR
Get Answers For Free
Most questions answered within 1 hours.