Complete the code to create a table for storing event data with an event ID as the primary key.
CREATE TABLE events (event_id [1] PRIMARY KEY, event_name VARCHAR(100));
The event_id should be an integer type to uniquely identify each event and serve as the primary key.
Complete the code to add a timestamp column to record when the event occurred.
ALTER TABLE events ADD COLUMN event_time [1];The TIMESTAMP type stores date and time information, perfect for recording event occurrence time.
Fix the error in the event schema by choosing the correct data type for event payload storage.
CREATE TABLE event_payloads (payload_id INT PRIMARY KEY, event_id INT, payload [1]);Event payloads can be large JSON or text data, so TEXT type is suitable for flexible storage.
Fill both blanks to create a foreign key relationship between event_payloads and events tables.
ALTER TABLE event_payloads ADD CONSTRAINT fk_event FOREIGN KEY ([1]) REFERENCES [2](event_id);
The foreign key column is event_id in event_payloads, referencing event_id in events table.
Fill all three blanks to create an index on event_time and event_name for faster queries.
CREATE INDEX idx_[1] ON events ([2], [3]);
The index name is arbitrary but descriptive. Indexing event_time and event_name speeds up queries filtering or sorting by these columns.